reactnative-plugin-appice 1.7.27 → 1.7.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/README.md +37 -37
  2. package/android/README.md +14 -14
  3. package/android/build.gradle +158 -158
  4. package/android/gitignore +47 -47
  5. package/android/gradle/wrapper/gradle-wrapper.properties +5 -5
  6. package/android/gradlew +234 -234
  7. package/android/local.properties +8 -8
  8. package/android/src/main/AndroidManifest.xml +164 -138
  9. package/android/src/main/java/com/reactlibrary/AppICEUtils.java +274 -274
  10. package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +778 -778
  11. package/android/src/main/java/com/reactlibrary/AppIceReactPluginPackage.java +28 -28
  12. package/android/src/main/java/com/reactlibrary/CampaignCampsReceiver.java +56 -56
  13. package/android/src/main/java/com/reactlibrary/EnumConstants.java +282 -282
  14. package/android/src/main/java/com/reactlibrary/NotificationEventService.java +59 -59
  15. package/android/src/main/java/com/reactlibrary/StringConstants.java +24 -24
  16. package/campaign.js +25 -25
  17. package/example/App.js +332 -332
  18. package/example/Gemfile +6 -6
  19. package/example/PageA.tsx +15 -15
  20. package/example/__tests__/App-test.js +14 -14
  21. package/example/ancilliary.js +486 -486
  22. package/example/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
  23. package/example/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
  24. package/example/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
  25. package/example/android/.gradle/7.3.3/gc.properties +0 -0
  26. package/example/android/.gradle/vcs-1/gc.properties +0 -0
  27. package/example/android/app/_BUCK +55 -55
  28. package/example/android/app/build.gradle +320 -320
  29. package/example/android/app/build_defs.bzl +19 -19
  30. package/example/android/app/proguard-rules.pro +10 -10
  31. package/example/android/app/src/debug/AndroidManifest.xml +13 -13
  32. package/example/android/app/src/debug/java/com/example/ReactNativeFlipper.java +73 -73
  33. package/example/android/app/src/main/AndroidManifest.xml +72 -72
  34. package/example/android/app/src/main/java/com/example/MainActivity.java +48 -48
  35. package/example/android/app/src/main/java/com/example/MainApplication.java +91 -91
  36. package/example/android/app/src/main/java/com/example/newarchitecture/MainApplicationReactNativeHost.java +116 -116
  37. package/example/android/app/src/main/java/com/example/newarchitecture/components/MainComponentsRegistry.java +36 -36
  38. package/example/android/app/src/main/java/com/example/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +48 -48
  39. package/example/android/app/src/main/jni/Android.mk +48 -48
  40. package/example/android/app/src/main/jni/MainApplicationModuleProvider.cpp +24 -24
  41. package/example/android/app/src/main/jni/MainApplicationModuleProvider.h +16 -16
  42. package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +45 -45
  43. package/example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +38 -38
  44. package/example/android/app/src/main/jni/MainComponentsRegistry.cpp +61 -61
  45. package/example/android/app/src/main/jni/MainComponentsRegistry.h +32 -32
  46. package/example/android/app/src/main/jni/OnLoad.cpp +11 -11
  47. package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -36
  48. package/example/android/app/src/main/res/values/strings.xml +3 -3
  49. package/example/android/app/src/main/res/values/styles.xml +9 -9
  50. package/example/android/build.gradle +73 -73
  51. package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -5
  52. package/example/android/gradle.properties +40 -40
  53. package/example/android/gradlew +234 -234
  54. package/example/android/settings.gradle +11 -11
  55. package/example/app.json +3 -3
  56. package/example/babel.config.js +3 -3
  57. package/example/index.js +9 -9
  58. package/example/ios/Podfile +44 -44
  59. package/example/ios/Podfile.lock +561 -561
  60. package/example/ios/_xcode.env +11 -11
  61. package/example/ios/example/AppDelegate.h +8 -8
  62. package/example/ios/example/AppDelegate.mm +174 -174
  63. package/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json +53 -53
  64. package/example/ios/example/Images.xcassets/Contents.json +6 -6
  65. package/example/ios/example/Info.plist +62 -62
  66. package/example/ios/example/LaunchScreen.storyboard +47 -47
  67. package/example/ios/example/example.entitlements +8 -8
  68. package/example/ios/example/main.m +10 -10
  69. package/example/ios/example.xcodeproj/project.pbxproj +712 -712
  70. package/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme +88 -88
  71. package/example/ios/example.xcworkspace/contents.xcworkspacedata +10 -10
  72. package/example/ios/example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  73. package/example/ios/exampleTests/Info.plist +24 -24
  74. package/example/ios/exampleTests/exampleTests.m +66 -66
  75. package/example/metro.config.js +17 -17
  76. package/example/package.json +36 -36
  77. package/example/yarn.lock +7176 -7176
  78. package/index.js +590 -590
  79. package/ios/AppICEReactEvent.h +23 -23
  80. package/ios/AppICEReactEvent.m +86 -86
  81. package/ios/AppIceReactPlugin.h +65 -65
  82. package/ios/AppIceReactPlugin.m +683 -683
  83. package/ios/AppIceReactPlugin.xcodeproj/project.pbxproj +364 -364
  84. package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -4
  85. package/ios/AppIceReactPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  86. package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
  87. package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
  88. package/ios/AppIceReactPlugin.xcworkspace/contents.xcworkspacedata +10 -10
  89. package/ios/AppIceReactPlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  90. package/ios/Podfile +10 -10
  91. package/ios/Podfile.lock +3 -3
  92. package/ios/Pods/Manifest.lock +3 -3
  93. package/ios/Pods/Pods.xcodeproj/project.pbxproj +395 -395
  94. package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/Pods-AppIceReactPlugin.xcscheme +58 -58
  95. package/ios/Pods/Pods.xcodeproj/xcuserdata/Adi.xcuserdatad/xcschemes/xcschememanagement.plist +18 -18
  96. package/ios/Pods/Pods.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
  97. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-Info.plist +26 -26
  98. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.markdown +3 -3
  99. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-acknowledgements.plist +29 -29
  100. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-dummy.m +5 -5
  101. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin-umbrella.h +16 -16
  102. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.debug.xcconfig +6 -6
  103. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.modulemap +6 -6
  104. package/ios/Pods/Target Support Files/Pods-AppIceReactPlugin/Pods-AppIceReactPlugin.release.xcconfig +6 -6
  105. package/package.json +9 -6
  106. package/reactnative-plugin-appice.podspec +30 -30
@@ -1,320 +1,320 @@
1
- apply plugin: "com.android.application"
2
-
3
- import com.android.build.OutputFile
4
-
5
- /**
6
- * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
- * and bundleReleaseJsAndAssets).
8
- * These basically call `react-native bundle` with the correct arguments during the Android build
9
- * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
- * bundle directly from the development server. Below you can see all the possible configurations
11
- * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
- * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
- *
14
- * project.ext.react = [
15
- * // the name of the generated asset file containing your JS bundle
16
- * bundleAssetName: "index.android.bundle",
17
- *
18
- * // the entry file for bundle generation. If none specified and
19
- * // "index.android.js" exists, it will be used. Otherwise "index.js" is
20
- * // default. Can be overridden with ENTRY_FILE environment variable.
21
- * entryFile: "index.android.js",
22
- *
23
- * // https://reactnative.dev/docs/performance#enable-the-ram-format
24
- * bundleCommand: "ram-bundle",
25
- *
26
- * // whether to bundle JS and assets in debug mode
27
- * bundleInDebug: false,
28
- *
29
- * // whether to bundle JS and assets in release mode
30
- * bundleInRelease: true,
31
- *
32
- * // whether to bundle JS and assets in another build variant (if configured).
33
- * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
34
- * // The configuration property can be in the following formats
35
- * // 'bundleIn${productFlavor}${buildType}'
36
- * // 'bundleIn${buildType}'
37
- * // bundleInFreeDebug: true,
38
- * // bundleInPaidRelease: true,
39
- * // bundleInBeta: true,
40
- *
41
- * // whether to disable dev mode in custom build variants (by default only disabled in release)
42
- * // for example: to disable dev mode in the staging build type (if configured)
43
- * devDisabledInStaging: true,
44
- * // The configuration property can be in the following formats
45
- * // 'devDisabledIn${productFlavor}${buildType}'
46
- * // 'devDisabledIn${buildType}'
47
- *
48
- * // the root of your project, i.e. where "package.json" lives
49
- * root: "../../",
50
- *
51
- * // where to put the JS bundle asset in debug mode
52
- * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
53
- *
54
- * // where to put the JS bundle asset in release mode
55
- * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
56
- *
57
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
58
- * // require('./image.png')), in debug mode
59
- * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
60
- *
61
- * // where to put drawable resources / React Native assets, e.g. the ones you use via
62
- * // require('./image.png')), in release mode
63
- * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
64
- *
65
- * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
66
- * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
67
- * // date; if you have any other folders that you want to ignore for performance reasons (gradle
68
- * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
69
- * // for example, you might want to remove it from here.
70
- * inputExcludes: ["android/**", "ios/**"],
71
- *
72
- * // override which node gets called and with what additional arguments
73
- * nodeExecutableAndArgs: ["node"],
74
- *
75
- * // supply additional arguments to the packager
76
- * extraPackagerArgs: []
77
- * ]
78
- */
79
-
80
- project.ext.react = [
81
- enableHermes: false, // clean and rebuild if changing
82
- ]
83
-
84
- apply from: "../../node_modules/react-native/react.gradle"
85
-
86
- /**
87
- * Set this to true to create two separate APKs instead of one:
88
- * - An APK that only works on ARM devices
89
- * - An APK that only works on x86 devices
90
- * The advantage is the size of the APK is reduced by about 4MB.
91
- * Upload all the APKs to the Play Store and people will download
92
- * the correct one based on the CPU architecture of their device.
93
- */
94
- def enableSeparateBuildPerCPUArchitecture = false
95
-
96
- /**
97
- * Run Proguard to shrink the Java bytecode in release builds.
98
- */
99
- def enableProguardInReleaseBuilds = false
100
-
101
- /**
102
- * The preferred build flavor of JavaScriptCore.
103
- *
104
- * For example, to use the international variant, you can use:
105
- * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
106
- *
107
- * The international variant includes ICU i18n library and necessary data
108
- * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
109
- * give correct results when using with locales other than en-US. Note that
110
- * this variant is about 6MiB larger per architecture than default.
111
- */
112
- def jscFlavor = 'org.webkit:android-jsc:+'
113
-
114
- /**
115
- * Whether to enable the Hermes VM.
116
- *
117
- * This should be set on project.ext.react and that value will be read here. If it is not set
118
- * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
119
- * and the benefits of using Hermes will therefore be sharply reduced.
120
- */
121
- def enableHermes = project.ext.react.get("enableHermes", false);
122
-
123
- /**
124
- * Architectures to build native code for.
125
- */
126
- def reactNativeArchitectures() {
127
- def value = project.getProperties().get("reactNativeArchitectures")
128
- return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
129
- }
130
-
131
- android {
132
- ndkVersion rootProject.ext.ndkVersion
133
-
134
- compileSdkVersion rootProject.ext.compileSdkVersion
135
-
136
- defaultConfig {
137
- applicationId "com.example"
138
- minSdkVersion rootProject.ext.minSdkVersion
139
- targetSdkVersion rootProject.ext.targetSdkVersion
140
- versionCode 1
141
- versionName "1.0"
142
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
143
-
144
- if (isNewArchitectureEnabled()) {
145
- // We configure the NDK build only if you decide to opt-in for the New Architecture.
146
- externalNativeBuild {
147
- ndkBuild {
148
- arguments "APP_PLATFORM=android-21",
149
- "APP_STL=c++_shared",
150
- "NDK_TOOLCHAIN_VERSION=clang",
151
- "GENERATED_SRC_DIR=$buildDir/generated/source",
152
- "PROJECT_BUILD_DIR=$buildDir",
153
- "REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
154
- "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
155
- "NODE_MODULES_DIR=$rootDir/../node_modules"
156
- cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
157
- cppFlags "-std=c++17"
158
- // Make sure this target name is the same you specify inside the
159
- // src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
160
- targets "example_appmodules"
161
- }
162
- }
163
- if (!enableSeparateBuildPerCPUArchitecture) {
164
- ndk {
165
- abiFilters (*reactNativeArchitectures())
166
- }
167
- }
168
- }
169
- }
170
-
171
- if (isNewArchitectureEnabled()) {
172
- // We configure the NDK build only if you decide to opt-in for the New Architecture.
173
- externalNativeBuild {
174
- ndkBuild {
175
- path "$projectDir/src/main/jni/Android.mk"
176
- }
177
- }
178
- def reactAndroidProjectDir = project(':ReactAndroid').projectDir
179
- def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
180
- dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
181
- from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
182
- into("$buildDir/react-ndk/exported")
183
- }
184
- def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
185
- dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
186
- from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
187
- into("$buildDir/react-ndk/exported")
188
- }
189
- afterEvaluate {
190
- // If you wish to add a custom TurboModule or component locally,
191
- // you should uncomment this line.
192
- // preBuild.dependsOn("generateCodegenArtifactsFromSchema")
193
- preDebugBuild.dependsOn(packageReactNdkDebugLibs)
194
- preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
195
-
196
- // Due to a bug inside AGP, we have to explicitly set a dependency
197
- // between configureNdkBuild* tasks and the preBuild tasks.
198
- // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
199
- configureNdkBuildRelease.dependsOn(preReleaseBuild)
200
- configureNdkBuildDebug.dependsOn(preDebugBuild)
201
- reactNativeArchitectures().each { architecture ->
202
- tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
203
- dependsOn("preDebugBuild")
204
- }
205
- tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
206
- dependsOn("preReleaseBuild")
207
- }
208
- }
209
- }
210
- }
211
-
212
- splits {
213
- abi {
214
- reset()
215
- enable enableSeparateBuildPerCPUArchitecture
216
- universalApk false // If true, also generate a universal APK
217
- include (*reactNativeArchitectures())
218
- }
219
- }
220
- signingConfigs {
221
- debug {
222
- storeFile file('debug.keystore')
223
- storePassword 'android'
224
- keyAlias 'androiddebugkey'
225
- keyPassword 'android'
226
- }
227
- }
228
- buildTypes {
229
- debug {
230
- signingConfig signingConfigs.debug
231
- }
232
- release {
233
- // Caution! In production, you need to generate your own keystore file.
234
- // see https://reactnative.dev/docs/signed-apk-android.
235
- signingConfig signingConfigs.debug
236
- minifyEnabled enableProguardInReleaseBuilds
237
- proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
238
- }
239
- }
240
-
241
- // applicationVariants are e.g. debug, release
242
- applicationVariants.all { variant ->
243
- variant.outputs.each { output ->
244
- // For each separate APK per architecture, set a unique version code as described here:
245
- // https://developer.android.com/studio/build/configure-apk-splits.html
246
- // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
247
- def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
248
- def abi = output.getFilter(OutputFile.ABI)
249
- if (abi != null) { // null for the universal-debug, universal-release variants
250
- output.versionCodeOverride =
251
- defaultConfig.versionCode * 1000 + versionCodes.get(abi)
252
- }
253
-
254
- }
255
- }
256
- }
257
-
258
- dependencies {
259
- implementation fileTree(dir: "libs", include: ["*.jar"])
260
-
261
- //noinspection GradleDynamicVersion
262
- implementation "com.facebook.react:react-native:+" // From node_modules
263
-
264
- implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
265
-
266
- debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
267
- exclude group:'com.facebook.fbjni'
268
- }
269
-
270
- debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
271
- exclude group:'com.facebook.flipper'
272
- exclude group:'com.squareup.okhttp3', module:'okhttp'
273
- }
274
-
275
- debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
276
- exclude group:'com.facebook.flipper'
277
- }
278
-
279
- if (enableHermes) {
280
- //noinspection GradleDynamicVersion
281
- implementation("com.facebook.react:hermes-engine:+") { // From node_modules
282
- exclude group:'com.facebook.fbjni'
283
- }
284
- } else {
285
- implementation jscFlavor
286
- }
287
- }
288
-
289
- if (isNewArchitectureEnabled()) {
290
- // If new architecture is enabled, we let you build RN from source
291
- // Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
292
- // This will be applied to all the imported transtitive dependency.
293
- configurations.all {
294
- resolutionStrategy.dependencySubstitution {
295
- substitute(module("com.facebook.react:react-native"))
296
- .using(project(":ReactAndroid"))
297
- .because("On New Architecture we're building React Native from source")
298
- substitute(module("com.facebook.react:hermes-engine"))
299
- .using(project(":ReactAndroid:hermes-engine"))
300
- .because("On New Architecture we're building Hermes from source")
301
- }
302
- }
303
- }
304
-
305
- // Run this once to be able to run the application with BUCK
306
- // puts all compile dependencies into folder libs for BUCK to use
307
- task copyDownloadableDepsToLibs(type: Copy) {
308
- from configurations.implementation
309
- into 'libs'
310
- }
311
-
312
- apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
313
-
314
- def isNewArchitectureEnabled() {
315
- // To opt-in for the New Architecture, you can either:
316
- // - Set `newArchEnabled` to true inside the `gradle.properties` file
317
- // - Invoke gradle with `-newArchEnabled=true`
318
- // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
319
- return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
320
- }
1
+ apply plugin: "com.android.application"
2
+
3
+ import com.android.build.OutputFile
4
+
5
+ /**
6
+ * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7
+ * and bundleReleaseJsAndAssets).
8
+ * These basically call `react-native bundle` with the correct arguments during the Android build
9
+ * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10
+ * bundle directly from the development server. Below you can see all the possible configurations
11
+ * and their defaults. If you decide to add a configuration block, make sure to add it before the
12
+ * `apply from: "../../node_modules/react-native/react.gradle"` line.
13
+ *
14
+ * project.ext.react = [
15
+ * // the name of the generated asset file containing your JS bundle
16
+ * bundleAssetName: "index.android.bundle",
17
+ *
18
+ * // the entry file for bundle generation. If none specified and
19
+ * // "index.android.js" exists, it will be used. Otherwise "index.js" is
20
+ * // default. Can be overridden with ENTRY_FILE environment variable.
21
+ * entryFile: "index.android.js",
22
+ *
23
+ * // https://reactnative.dev/docs/performance#enable-the-ram-format
24
+ * bundleCommand: "ram-bundle",
25
+ *
26
+ * // whether to bundle JS and assets in debug mode
27
+ * bundleInDebug: false,
28
+ *
29
+ * // whether to bundle JS and assets in release mode
30
+ * bundleInRelease: true,
31
+ *
32
+ * // whether to bundle JS and assets in another build variant (if configured).
33
+ * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
34
+ * // The configuration property can be in the following formats
35
+ * // 'bundleIn${productFlavor}${buildType}'
36
+ * // 'bundleIn${buildType}'
37
+ * // bundleInFreeDebug: true,
38
+ * // bundleInPaidRelease: true,
39
+ * // bundleInBeta: true,
40
+ *
41
+ * // whether to disable dev mode in custom build variants (by default only disabled in release)
42
+ * // for example: to disable dev mode in the staging build type (if configured)
43
+ * devDisabledInStaging: true,
44
+ * // The configuration property can be in the following formats
45
+ * // 'devDisabledIn${productFlavor}${buildType}'
46
+ * // 'devDisabledIn${buildType}'
47
+ *
48
+ * // the root of your project, i.e. where "package.json" lives
49
+ * root: "../../",
50
+ *
51
+ * // where to put the JS bundle asset in debug mode
52
+ * jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
53
+ *
54
+ * // where to put the JS bundle asset in release mode
55
+ * jsBundleDirRelease: "$buildDir/intermediates/assets/release",
56
+ *
57
+ * // where to put drawable resources / React Native assets, e.g. the ones you use via
58
+ * // require('./image.png')), in debug mode
59
+ * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
60
+ *
61
+ * // where to put drawable resources / React Native assets, e.g. the ones you use via
62
+ * // require('./image.png')), in release mode
63
+ * resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
64
+ *
65
+ * // by default the gradle tasks are skipped if none of the JS files or assets change; this means
66
+ * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
67
+ * // date; if you have any other folders that you want to ignore for performance reasons (gradle
68
+ * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
69
+ * // for example, you might want to remove it from here.
70
+ * inputExcludes: ["android/**", "ios/**"],
71
+ *
72
+ * // override which node gets called and with what additional arguments
73
+ * nodeExecutableAndArgs: ["node"],
74
+ *
75
+ * // supply additional arguments to the packager
76
+ * extraPackagerArgs: []
77
+ * ]
78
+ */
79
+
80
+ project.ext.react = [
81
+ enableHermes: false, // clean and rebuild if changing
82
+ ]
83
+
84
+ apply from: "../../node_modules/react-native/react.gradle"
85
+
86
+ /**
87
+ * Set this to true to create two separate APKs instead of one:
88
+ * - An APK that only works on ARM devices
89
+ * - An APK that only works on x86 devices
90
+ * The advantage is the size of the APK is reduced by about 4MB.
91
+ * Upload all the APKs to the Play Store and people will download
92
+ * the correct one based on the CPU architecture of their device.
93
+ */
94
+ def enableSeparateBuildPerCPUArchitecture = false
95
+
96
+ /**
97
+ * Run Proguard to shrink the Java bytecode in release builds.
98
+ */
99
+ def enableProguardInReleaseBuilds = false
100
+
101
+ /**
102
+ * The preferred build flavor of JavaScriptCore.
103
+ *
104
+ * For example, to use the international variant, you can use:
105
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
106
+ *
107
+ * The international variant includes ICU i18n library and necessary data
108
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
109
+ * give correct results when using with locales other than en-US. Note that
110
+ * this variant is about 6MiB larger per architecture than default.
111
+ */
112
+ def jscFlavor = 'org.webkit:android-jsc:+'
113
+
114
+ /**
115
+ * Whether to enable the Hermes VM.
116
+ *
117
+ * This should be set on project.ext.react and that value will be read here. If it is not set
118
+ * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
119
+ * and the benefits of using Hermes will therefore be sharply reduced.
120
+ */
121
+ def enableHermes = project.ext.react.get("enableHermes", false);
122
+
123
+ /**
124
+ * Architectures to build native code for.
125
+ */
126
+ def reactNativeArchitectures() {
127
+ def value = project.getProperties().get("reactNativeArchitectures")
128
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
129
+ }
130
+
131
+ android {
132
+ ndkVersion rootProject.ext.ndkVersion
133
+
134
+ compileSdkVersion rootProject.ext.compileSdkVersion
135
+
136
+ defaultConfig {
137
+ applicationId "com.example"
138
+ minSdkVersion rootProject.ext.minSdkVersion
139
+ targetSdkVersion rootProject.ext.targetSdkVersion
140
+ versionCode 1
141
+ versionName "1.0"
142
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
143
+
144
+ if (isNewArchitectureEnabled()) {
145
+ // We configure the NDK build only if you decide to opt-in for the New Architecture.
146
+ externalNativeBuild {
147
+ ndkBuild {
148
+ arguments "APP_PLATFORM=android-21",
149
+ "APP_STL=c++_shared",
150
+ "NDK_TOOLCHAIN_VERSION=clang",
151
+ "GENERATED_SRC_DIR=$buildDir/generated/source",
152
+ "PROJECT_BUILD_DIR=$buildDir",
153
+ "REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
154
+ "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
155
+ "NODE_MODULES_DIR=$rootDir/../node_modules"
156
+ cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
157
+ cppFlags "-std=c++17"
158
+ // Make sure this target name is the same you specify inside the
159
+ // src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
160
+ targets "example_appmodules"
161
+ }
162
+ }
163
+ if (!enableSeparateBuildPerCPUArchitecture) {
164
+ ndk {
165
+ abiFilters (*reactNativeArchitectures())
166
+ }
167
+ }
168
+ }
169
+ }
170
+
171
+ if (isNewArchitectureEnabled()) {
172
+ // We configure the NDK build only if you decide to opt-in for the New Architecture.
173
+ externalNativeBuild {
174
+ ndkBuild {
175
+ path "$projectDir/src/main/jni/Android.mk"
176
+ }
177
+ }
178
+ def reactAndroidProjectDir = project(':ReactAndroid').projectDir
179
+ def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
180
+ dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
181
+ from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
182
+ into("$buildDir/react-ndk/exported")
183
+ }
184
+ def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
185
+ dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
186
+ from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
187
+ into("$buildDir/react-ndk/exported")
188
+ }
189
+ afterEvaluate {
190
+ // If you wish to add a custom TurboModule or component locally,
191
+ // you should uncomment this line.
192
+ // preBuild.dependsOn("generateCodegenArtifactsFromSchema")
193
+ preDebugBuild.dependsOn(packageReactNdkDebugLibs)
194
+ preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
195
+
196
+ // Due to a bug inside AGP, we have to explicitly set a dependency
197
+ // between configureNdkBuild* tasks and the preBuild tasks.
198
+ // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
199
+ configureNdkBuildRelease.dependsOn(preReleaseBuild)
200
+ configureNdkBuildDebug.dependsOn(preDebugBuild)
201
+ reactNativeArchitectures().each { architecture ->
202
+ tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
203
+ dependsOn("preDebugBuild")
204
+ }
205
+ tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
206
+ dependsOn("preReleaseBuild")
207
+ }
208
+ }
209
+ }
210
+ }
211
+
212
+ splits {
213
+ abi {
214
+ reset()
215
+ enable enableSeparateBuildPerCPUArchitecture
216
+ universalApk false // If true, also generate a universal APK
217
+ include (*reactNativeArchitectures())
218
+ }
219
+ }
220
+ signingConfigs {
221
+ debug {
222
+ storeFile file('debug.keystore')
223
+ storePassword 'android'
224
+ keyAlias 'androiddebugkey'
225
+ keyPassword 'android'
226
+ }
227
+ }
228
+ buildTypes {
229
+ debug {
230
+ signingConfig signingConfigs.debug
231
+ }
232
+ release {
233
+ // Caution! In production, you need to generate your own keystore file.
234
+ // see https://reactnative.dev/docs/signed-apk-android.
235
+ signingConfig signingConfigs.debug
236
+ minifyEnabled enableProguardInReleaseBuilds
237
+ proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
238
+ }
239
+ }
240
+
241
+ // applicationVariants are e.g. debug, release
242
+ applicationVariants.all { variant ->
243
+ variant.outputs.each { output ->
244
+ // For each separate APK per architecture, set a unique version code as described here:
245
+ // https://developer.android.com/studio/build/configure-apk-splits.html
246
+ // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
247
+ def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
248
+ def abi = output.getFilter(OutputFile.ABI)
249
+ if (abi != null) { // null for the universal-debug, universal-release variants
250
+ output.versionCodeOverride =
251
+ defaultConfig.versionCode * 1000 + versionCodes.get(abi)
252
+ }
253
+
254
+ }
255
+ }
256
+ }
257
+
258
+ dependencies {
259
+ implementation fileTree(dir: "libs", include: ["*.jar"])
260
+
261
+ //noinspection GradleDynamicVersion
262
+ implementation "com.facebook.react:react-native:+" // From node_modules
263
+
264
+ implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
265
+
266
+ debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
267
+ exclude group:'com.facebook.fbjni'
268
+ }
269
+
270
+ debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
271
+ exclude group:'com.facebook.flipper'
272
+ exclude group:'com.squareup.okhttp3', module:'okhttp'
273
+ }
274
+
275
+ debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
276
+ exclude group:'com.facebook.flipper'
277
+ }
278
+
279
+ if (enableHermes) {
280
+ //noinspection GradleDynamicVersion
281
+ implementation("com.facebook.react:hermes-engine:+") { // From node_modules
282
+ exclude group:'com.facebook.fbjni'
283
+ }
284
+ } else {
285
+ implementation jscFlavor
286
+ }
287
+ }
288
+
289
+ if (isNewArchitectureEnabled()) {
290
+ // If new architecture is enabled, we let you build RN from source
291
+ // Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
292
+ // This will be applied to all the imported transtitive dependency.
293
+ configurations.all {
294
+ resolutionStrategy.dependencySubstitution {
295
+ substitute(module("com.facebook.react:react-native"))
296
+ .using(project(":ReactAndroid"))
297
+ .because("On New Architecture we're building React Native from source")
298
+ substitute(module("com.facebook.react:hermes-engine"))
299
+ .using(project(":ReactAndroid:hermes-engine"))
300
+ .because("On New Architecture we're building Hermes from source")
301
+ }
302
+ }
303
+ }
304
+
305
+ // Run this once to be able to run the application with BUCK
306
+ // puts all compile dependencies into folder libs for BUCK to use
307
+ task copyDownloadableDepsToLibs(type: Copy) {
308
+ from configurations.implementation
309
+ into 'libs'
310
+ }
311
+
312
+ apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
313
+
314
+ def isNewArchitectureEnabled() {
315
+ // To opt-in for the New Architecture, you can either:
316
+ // - Set `newArchEnabled` to true inside the `gradle.properties` file
317
+ // - Invoke gradle with `-newArchEnabled=true`
318
+ // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
319
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
320
+ }