@snowplow/react-native-tracker 2.1.2 → 4.0.2-dev.0
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.
- package/LICENSE +29 -203
- package/README.md +59 -143
- package/dist/index.cjs.d.ts +499 -0
- package/dist/index.cjs.js +2656 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.cjs.min.d.ts +499 -0
- package/dist/index.cjs.min.js +63 -0
- package/dist/index.cjs.min.js.map +1 -0
- package/dist/index.module.d.ts +499 -0
- package/dist/index.module.js +250 -0
- package/dist/index.module.js.map +1 -0
- package/package.json +48 -158
- package/.editorconfig +0 -15
- package/.eslintignore +0 -6
- package/.gitattributes +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -29
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/actions/setup/action.yml +0 -28
- package/.github/workflows/build.yml +0 -155
- package/.github/workflows/deploy.yml +0 -97
- package/.github/workflows/e2e-android.yml +0 -121
- package/.github/workflows/e2e-ios.yml +0 -95
- package/.github/workflows/snyk.yml +0 -21
- package/.gitignore +0 -70
- package/.npmignore +0 -60
- package/.nvmrc +0 -1
- package/.watchmanconfig +0 -1
- package/.yarnrc +0 -3
- package/CHANGELOG +0 -184
- package/CONTRIBUTING.md +0 -80
- package/android/build.gradle +0 -110
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/android/gradle.properties +0 -5
- package/android/gradlew +0 -234
- package/android/gradlew.bat +0 -89
- package/android/src/main/AndroidManifest.xml +0 -3
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerModule.kt +0 -744
- package/android/src/main/java/com/snowplow/reactnativetracker/ReactNativeTrackerPackage.kt +0 -17
- package/android/src/main/java/com/snowplow/reactnativetracker/util/ConfigUtil.kt +0 -274
- package/android/src/main/java/com/snowplow/reactnativetracker/util/EventUtil.kt +0 -233
- package/android/src/main/java/com/snowplow/reactnativetracker/util/TrackerVersion.kt +0 -5
- package/babel.config.js +0 -3
- package/example/.watchmanconfig +0 -1
- package/example/Gemfile +0 -6
- package/example/android/app/build.gradle +0 -129
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +0 -10
- package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTest.java +0 -36
- package/example/android/app/src/androidTest/java/com/reactnativetrackerexample/DetoxTestAppJUnitRunner.java +0 -21
- package/example/android/app/src/debug/AndroidManifest.xml +0 -13
- package/example/android/app/src/debug/java/com/reactnativetrackerexample/ReactNativeFlipper.java +0 -75
- package/example/android/app/src/main/AndroidManifest.xml +0 -26
- package/example/android/app/src/main/java/com/reactnativetrackerexample/MainActivity.java +0 -32
- package/example/android/app/src/main/java/com/reactnativetrackerexample/MainApplication.java +0 -62
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -36
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +0 -3
- package/example/android/app/src/main/res/values/styles.xml +0 -9
- package/example/android/app/src/release/java/com/reactnativetrackerexample/ReactNativeFlipper.java +0 -20
- package/example/android/build.gradle +0 -31
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/example/android/gradle.properties +0 -44
- package/example/android/gradlew +0 -244
- package/example/android/gradlew.bat +0 -92
- package/example/android/settings.gradle +0 -4
- package/example/app.json +0 -4
- package/example/babel.config.js +0 -17
- package/example/detox.config.js +0 -92
- package/example/e2e/config.json +0 -10
- package/example/e2e/emitEvents.e2e.detox.js +0 -95
- package/example/e2e/environment.js +0 -23
- package/example/e2e/helpers/microCommands.js +0 -140
- package/example/e2e/helpers/microHelpers.js +0 -333
- package/example/e2e/helpers/microHelpers.test.js +0 -295
- package/example/e2e/helpers/schemas.js +0 -49
- package/example/e2e/jest.config.js +0 -16
- package/example/e2e/setup.js +0 -4
- package/example/e2e/testEvents.micro.test.js +0 -287
- package/example/index.js +0 -5
- package/example/ios/.xcode.env +0 -11
- package/example/ios/Podfile +0 -62
- package/example/ios/Podfile.lock +0 -730
- package/example/ios/ReactNativeTrackerExample/AppDelegate.h +0 -6
- package/example/ios/ReactNativeTrackerExample/AppDelegate.mm +0 -26
- package/example/ios/ReactNativeTrackerExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
- package/example/ios/ReactNativeTrackerExample/Images.xcassets/Contents.json +0 -6
- package/example/ios/ReactNativeTrackerExample/Info.plist +0 -55
- package/example/ios/ReactNativeTrackerExample/LaunchScreen.storyboard +0 -47
- package/example/ios/ReactNativeTrackerExample/PrivacyInfo.xcprivacy +0 -37
- package/example/ios/ReactNativeTrackerExample/main.m +0 -10
- package/example/ios/ReactNativeTrackerExample-Bridging-Header.h +0 -3
- package/example/ios/ReactNativeTrackerExample.xcodeproj/project.pbxproj +0 -739
- package/example/ios/ReactNativeTrackerExample.xcodeproj/xcshareddata/xcschemes/ReactNativeTrackerExample.xcscheme +0 -88
- package/example/ios/ReactNativeTrackerExample.xcworkspace/contents.xcworkspacedata +0 -10
- package/example/ios/ReactNativeTrackerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/example/ios/ReactNativeTrackerExampleTests/Info.plist +0 -24
- package/example/ios/ReactNativeTrackerExampleTests/ReactNativeTrackerExampleTests.m +0 -66
- package/example/metro.config.js +0 -45
- package/example/package.json +0 -54
- package/example/react-native.config.js +0 -10
- package/example/src/App.js +0 -566
- package/example/tsconfig.json +0 -5
- package/example/yarn.lock +0 -7703
- package/ios/ReactNativeTracker-Bridging-Header.h +0 -2
- package/ios/ReactNativeTracker.mm +0 -171
- package/ios/ReactNativeTracker.swift +0 -822
- package/ios/ReactNativeTracker.xcodeproj/project.pbxproj +0 -301
- package/ios/Util/ConfigUtils.swift +0 -209
- package/ios/Util/TrackerVersion.swift +0 -3
- package/ios/Util/Utilities.swift +0 -37
- package/lefthook.yml +0 -11
- package/lib/commonjs/api.js +0 -490
- package/lib/commonjs/api.js.map +0 -1
- package/lib/commonjs/configurations.js +0 -196
- package/lib/commonjs/configurations.js.map +0 -1
- package/lib/commonjs/constants.js +0 -77
- package/lib/commonjs/constants.js.map +0 -1
- package/lib/commonjs/events.js +0 -277
- package/lib/commonjs/events.js.map +0 -1
- package/lib/commonjs/index.js +0 -132
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/jsCore.js +0 -427
- package/lib/commonjs/jsCore.js.map +0 -1
- package/lib/commonjs/native.js +0 -16
- package/lib/commonjs/native.js.map +0 -1
- package/lib/commonjs/subject.js +0 -235
- package/lib/commonjs/subject.js.map +0 -1
- package/lib/commonjs/tracker.js +0 -248
- package/lib/commonjs/tracker.js.map +0 -1
- package/lib/commonjs/types.js +0 -2
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils.js +0 -72
- package/lib/commonjs/utils.js.map +0 -1
- package/lib/commonjs/webViewInterface.js +0 -66
- package/lib/commonjs/webViewInterface.js.map +0 -1
- package/lib/module/api.js +0 -452
- package/lib/module/api.js.map +0 -1
- package/lib/module/configurations.js +0 -184
- package/lib/module/configurations.js.map +0 -1
- package/lib/module/constants.js +0 -72
- package/lib/module/constants.js.map +0 -1
- package/lib/module/events.js +0 -259
- package/lib/module/events.js.map +0 -1
- package/lib/module/index.js +0 -120
- package/lib/module/index.js.map +0 -1
- package/lib/module/jsCore.js +0 -424
- package/lib/module/jsCore.js.map +0 -1
- package/lib/module/native.js +0 -12
- package/lib/module/native.js.map +0 -1
- package/lib/module/subject.js +0 -222
- package/lib/module/subject.js.map +0 -1
- package/lib/module/tracker.js +0 -234
- package/lib/module/tracker.js.map +0 -1
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils.js +0 -66
- package/lib/module/utils.js.map +0 -1
- package/lib/module/webViewInterface.js +0 -62
- package/lib/module/webViewInterface.js.map +0 -1
- package/lib/typescript/__tests__/api.test.d.ts +0 -2
- package/lib/typescript/__tests__/api.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/configurations.test.d.ts +0 -2
- package/lib/typescript/__tests__/configurations.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/events.test.d.ts +0 -2
- package/lib/typescript/__tests__/events.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/index.test.d.ts +0 -2
- package/lib/typescript/__tests__/index.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/jsCore.test.d.ts +0 -2
- package/lib/typescript/__tests__/jsCore.test.d.ts.map +0 -1
- package/lib/typescript/__tests__/utils.test.d.ts +0 -2
- package/lib/typescript/__tests__/utils.test.d.ts.map +0 -1
- package/lib/typescript/api.d.ts +0 -240
- package/lib/typescript/api.d.ts.map +0 -1
- package/lib/typescript/configurations.d.ts +0 -73
- package/lib/typescript/configurations.d.ts.map +0 -1
- package/lib/typescript/constants.d.ts +0 -64
- package/lib/typescript/constants.d.ts.map +0 -1
- package/lib/typescript/events.d.ts +0 -115
- package/lib/typescript/events.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -27
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/jsCore.d.ts +0 -152
- package/lib/typescript/jsCore.d.ts.map +0 -1
- package/lib/typescript/native.d.ts +0 -4
- package/lib/typescript/native.d.ts.map +0 -1
- package/lib/typescript/subject.d.ts +0 -91
- package/lib/typescript/subject.d.ts.map +0 -1
- package/lib/typescript/tracker.d.ts +0 -111
- package/lib/typescript/tracker.d.ts.map +0 -1
- package/lib/typescript/types.d.ts +0 -981
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils.d.ts +0 -35
- package/lib/typescript/utils.d.ts.map +0 -1
- package/lib/typescript/webViewInterface.d.ts +0 -15
- package/lib/typescript/webViewInterface.d.ts.map +0 -1
- package/scripts/bootstrap.js +0 -29
- package/snowplow-react-native-tracker.podspec +0 -42
- package/src/__mocks__/react-native.js +0 -7
- package/src/__tests__/api.test.ts +0 -21
- package/src/__tests__/configurations.test.ts +0 -608
- package/src/__tests__/events.test.ts +0 -736
- package/src/__tests__/index.test.ts +0 -14
- package/src/__tests__/jsCore.test.ts +0 -199
- package/src/__tests__/utils.test.ts +0 -10
- package/src/api.ts +0 -556
- package/src/configurations.ts +0 -325
- package/src/constants.ts +0 -97
- package/src/events.ts +0 -355
- package/src/index.ts +0 -184
- package/src/jsCore.ts +0 -603
- package/src/native.ts +0 -21
- package/src/subject.ts +0 -302
- package/src/tracker.ts +0 -377
- package/src/types.ts +0 -1162
- package/src/utils.ts +0 -65
- package/src/webViewInterface.ts +0 -92
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -28
- package/turbo.json +0 -34
- package/yarn.lock +0 -9398
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
package com.snowplow.reactnativetracker
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactPackage
|
|
4
|
-
import com.facebook.react.bridge.NativeModule
|
|
5
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.uimanager.ViewManager
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ReactNativeTrackerPackage : ReactPackage {
|
|
10
|
-
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
|
-
return listOf(ReactNativeTrackerModule(reactContext))
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
15
|
-
return emptyList()
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
package com.snowplow.reactnativetracker.util
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReactApplicationContext
|
|
4
|
-
import com.facebook.react.bridge.ReadableArray
|
|
5
|
-
import com.facebook.react.bridge.ReadableMap
|
|
6
|
-
import com.snowplowanalytics.snowplow.configuration.*
|
|
7
|
-
import com.snowplowanalytics.snowplow.emitter.BufferOption
|
|
8
|
-
import com.snowplowanalytics.snowplow.globalcontexts.GlobalContext
|
|
9
|
-
import com.snowplowanalytics.snowplow.payload.SelfDescribingJson
|
|
10
|
-
import com.snowplowanalytics.snowplow.tracker.DevicePlatform
|
|
11
|
-
import com.snowplowanalytics.snowplow.tracker.LogLevel
|
|
12
|
-
import com.snowplowanalytics.snowplow.util.Basis
|
|
13
|
-
import com.snowplowanalytics.snowplow.util.Size
|
|
14
|
-
import com.snowplowanalytics.snowplow.util.TimeMeasure
|
|
15
|
-
import java.util.concurrent.TimeUnit
|
|
16
|
-
|
|
17
|
-
object ConfigUtil {
|
|
18
|
-
fun mkTrackerConfiguration(
|
|
19
|
-
trackerConfig: ReadableMap?,
|
|
20
|
-
context: ReactApplicationContext
|
|
21
|
-
): TrackerConfiguration {
|
|
22
|
-
val appId = trackerConfig?.getString("appId") ?: context.packageName
|
|
23
|
-
val trackerConfiguration = TrackerConfiguration(appId)
|
|
24
|
-
.trackerVersionSuffix(TrackerVersion.RN_TRACKER_VERSION)
|
|
25
|
-
.screenViewAutotracking(false)
|
|
26
|
-
|
|
27
|
-
val trackerConfig = trackerConfig ?: run { return trackerConfiguration }
|
|
28
|
-
if (trackerConfig.hasKey("devicePlatform")) {
|
|
29
|
-
val devicePlatform = mkDevicePlatform(trackerConfig.getString("devicePlatform")!!)
|
|
30
|
-
trackerConfiguration.devicePlatform(devicePlatform)
|
|
31
|
-
}
|
|
32
|
-
if (trackerConfig.hasKey("logLevel")) {
|
|
33
|
-
val logLevel = mkLogLevel(trackerConfig.getString("logLevel")!!)
|
|
34
|
-
trackerConfiguration.logLevel(logLevel)
|
|
35
|
-
}
|
|
36
|
-
if (trackerConfig.hasKey("base64Encoding")) {
|
|
37
|
-
trackerConfiguration.base64encoding(trackerConfig.getBoolean("base64Encoding"))
|
|
38
|
-
}
|
|
39
|
-
if (trackerConfig.hasKey("applicationContext")) {
|
|
40
|
-
trackerConfiguration.applicationContext(trackerConfig.getBoolean("applicationContext"))
|
|
41
|
-
}
|
|
42
|
-
if (trackerConfig.hasKey("platformContext")) {
|
|
43
|
-
trackerConfiguration.platformContext(trackerConfig.getBoolean("platformContext"))
|
|
44
|
-
}
|
|
45
|
-
if (trackerConfig.hasKey("geoLocationContext")) {
|
|
46
|
-
trackerConfiguration.geoLocationContext(trackerConfig.getBoolean("geoLocationContext"))
|
|
47
|
-
}
|
|
48
|
-
if (trackerConfig.hasKey("sessionContext")) {
|
|
49
|
-
trackerConfiguration.sessionContext(trackerConfig.getBoolean("sessionContext"))
|
|
50
|
-
}
|
|
51
|
-
if (trackerConfig.hasKey("screenContext")) {
|
|
52
|
-
trackerConfiguration.screenContext(trackerConfig.getBoolean("screenContext"))
|
|
53
|
-
}
|
|
54
|
-
if (trackerConfig.hasKey("screenViewAutotracking")) {
|
|
55
|
-
trackerConfiguration.screenViewAutotracking(trackerConfig.getBoolean("screenViewAutotracking"))
|
|
56
|
-
}
|
|
57
|
-
if (trackerConfig.hasKey("screenEngagementAutotracking")) {
|
|
58
|
-
trackerConfiguration.screenEngagementAutotracking(trackerConfig.getBoolean("screenEngagementAutotracking"))
|
|
59
|
-
}
|
|
60
|
-
if (trackerConfig.hasKey("lifecycleAutotracking")) {
|
|
61
|
-
trackerConfiguration.lifecycleAutotracking(trackerConfig.getBoolean("lifecycleAutotracking"))
|
|
62
|
-
}
|
|
63
|
-
if (trackerConfig.hasKey("installAutotracking")) {
|
|
64
|
-
trackerConfiguration.installAutotracking(trackerConfig.getBoolean("installAutotracking"))
|
|
65
|
-
}
|
|
66
|
-
if (trackerConfig.hasKey("exceptionAutotracking")) {
|
|
67
|
-
trackerConfiguration.exceptionAutotracking(trackerConfig.getBoolean("exceptionAutotracking"))
|
|
68
|
-
}
|
|
69
|
-
if (trackerConfig.hasKey("diagnosticAutotracking")) {
|
|
70
|
-
trackerConfiguration.diagnosticAutotracking(trackerConfig.getBoolean("diagnosticAutotracking"))
|
|
71
|
-
}
|
|
72
|
-
if (trackerConfig.hasKey("deepLinkContext")) {
|
|
73
|
-
trackerConfiguration.deepLinkContext(trackerConfig.getBoolean("deepLinkContext"))
|
|
74
|
-
}
|
|
75
|
-
if (trackerConfig.hasKey("userAnonymisation")) {
|
|
76
|
-
trackerConfiguration.userAnonymisation(trackerConfig.getBoolean("userAnonymisation"))
|
|
77
|
-
}
|
|
78
|
-
return trackerConfiguration
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
fun mkSessionConfiguration(sessionConfig: ReadableMap): SessionConfiguration {
|
|
82
|
-
val foregroundTimeout = sessionConfig.getDouble("foregroundTimeout").toLong()
|
|
83
|
-
val backgroundTimeout = sessionConfig.getDouble("backgroundTimeout").toLong()
|
|
84
|
-
return SessionConfiguration(
|
|
85
|
-
TimeMeasure(foregroundTimeout, TimeUnit.SECONDS),
|
|
86
|
-
TimeMeasure(backgroundTimeout, TimeUnit.SECONDS)
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
fun mkEmitterConfiguration(emitterConfig: ReadableMap): EmitterConfiguration {
|
|
91
|
-
val emitterConfiguration = EmitterConfiguration()
|
|
92
|
-
emitterConfig.getString("bufferOption")?.let { opt -> mkBufferOption(opt)?.let { emitterConfiguration.bufferOption(it) } }
|
|
93
|
-
if (emitterConfig.hasKey("emitRange")) {
|
|
94
|
-
val emitRange = emitterConfig.getDouble("emitRange").toInt()
|
|
95
|
-
emitterConfiguration.emitRange(emitRange)
|
|
96
|
-
}
|
|
97
|
-
if (emitterConfig.hasKey("threadPoolSize")) {
|
|
98
|
-
val threadPoolSize = emitterConfig.getDouble("threadPoolSize").toInt()
|
|
99
|
-
emitterConfiguration.threadPoolSize(threadPoolSize)
|
|
100
|
-
}
|
|
101
|
-
if (emitterConfig.hasKey("byteLimitPost")) {
|
|
102
|
-
val byteLimitPost = emitterConfig.getDouble("byteLimitPost").toInt()
|
|
103
|
-
emitterConfiguration.byteLimitPost(byteLimitPost)
|
|
104
|
-
}
|
|
105
|
-
if (emitterConfig.hasKey("byteLimitGet")) {
|
|
106
|
-
val byteLimitGet = emitterConfig.getDouble("byteLimitGet").toInt()
|
|
107
|
-
emitterConfiguration.byteLimitGet(byteLimitGet)
|
|
108
|
-
}
|
|
109
|
-
if (emitterConfig.hasKey("serverAnonymisation")) {
|
|
110
|
-
emitterConfiguration.serverAnonymisation(emitterConfig.getBoolean("serverAnonymisation"))
|
|
111
|
-
}
|
|
112
|
-
return emitterConfiguration
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
fun mkSubjectConfiguration(subjectConfig: ReadableMap): SubjectConfiguration {
|
|
116
|
-
val subjectConfiguration = SubjectConfiguration()
|
|
117
|
-
if (subjectConfig.hasKey("userId")) {
|
|
118
|
-
if (subjectConfig.isNull("userId")) {
|
|
119
|
-
subjectConfiguration.userId(null)
|
|
120
|
-
} else {
|
|
121
|
-
subjectConfiguration.userId(subjectConfig.getString("userId"))
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (subjectConfig.hasKey("networkUserId")) {
|
|
125
|
-
if (subjectConfig.isNull("networkUserId")) {
|
|
126
|
-
subjectConfiguration.networkUserId(null)
|
|
127
|
-
} else {
|
|
128
|
-
subjectConfiguration.networkUserId(subjectConfig.getString("networkUserId"))
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (subjectConfig.hasKey("domainUserId")) {
|
|
132
|
-
if (subjectConfig.isNull("domainUserId")) {
|
|
133
|
-
subjectConfiguration.domainUserId(null)
|
|
134
|
-
} else {
|
|
135
|
-
subjectConfiguration.domainUserId(subjectConfig.getString("domainUserId"))
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
if (subjectConfig.hasKey("useragent")) {
|
|
139
|
-
if (subjectConfig.isNull("useragent")) {
|
|
140
|
-
subjectConfiguration.useragent(null)
|
|
141
|
-
} else {
|
|
142
|
-
subjectConfiguration.useragent(subjectConfig.getString("useragent"))
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
if (subjectConfig.hasKey("ipAddress")) {
|
|
146
|
-
if (subjectConfig.isNull("ipAddress")) {
|
|
147
|
-
subjectConfiguration.ipAddress(null)
|
|
148
|
-
} else {
|
|
149
|
-
subjectConfiguration.ipAddress(subjectConfig.getString("ipAddress"))
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (subjectConfig.hasKey("timezone")) {
|
|
153
|
-
if (subjectConfig.isNull("timezone")) {
|
|
154
|
-
subjectConfiguration.timezone(null)
|
|
155
|
-
} else {
|
|
156
|
-
subjectConfiguration.timezone(subjectConfig.getString("timezone"))
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
if (subjectConfig.hasKey("language")) {
|
|
160
|
-
if (subjectConfig.isNull("language")) {
|
|
161
|
-
subjectConfiguration.language(null)
|
|
162
|
-
} else {
|
|
163
|
-
subjectConfiguration.language(subjectConfig.getString("language"))
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (subjectConfig.hasKey("screenResolution")) {
|
|
167
|
-
if (subjectConfig.isNull("screenResolution")) {
|
|
168
|
-
subjectConfiguration.screenResolution(null)
|
|
169
|
-
} else {
|
|
170
|
-
val screenRes: ReadableArray = subjectConfig.getArray("screenResolution")!!
|
|
171
|
-
val screenWidth = screenRes.getDouble(0).toInt()
|
|
172
|
-
val screenHeight = screenRes.getDouble(1).toInt()
|
|
173
|
-
val screenResolution = Size(screenWidth, screenHeight)
|
|
174
|
-
subjectConfiguration.screenResolution(screenResolution)
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (subjectConfig.hasKey("screenViewport")) {
|
|
178
|
-
if (subjectConfig.isNull("screenViewport")) {
|
|
179
|
-
subjectConfiguration.screenViewPort(null)
|
|
180
|
-
} else {
|
|
181
|
-
val screenVP: ReadableArray = subjectConfig.getArray("screenViewport")!!
|
|
182
|
-
val screenVPWidth = screenVP.getDouble(0).toInt()
|
|
183
|
-
val screenVPHeight = screenVP.getDouble(1).toInt()
|
|
184
|
-
val screenViewport = Size(screenVPWidth, screenVPHeight)
|
|
185
|
-
subjectConfiguration.screenViewPort(screenViewport)
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
if (subjectConfig.hasKey("colorDepth")) {
|
|
189
|
-
if (subjectConfig.isNull("colorDepth")) {
|
|
190
|
-
subjectConfiguration.colorDepth(null)
|
|
191
|
-
} else {
|
|
192
|
-
val colorDepth = subjectConfig.getDouble("colorDepth").toInt()
|
|
193
|
-
subjectConfiguration.colorDepth(colorDepth)
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
return subjectConfiguration
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
fun mkGdprConfiguration(gdprConfig: ReadableMap): GdprConfiguration {
|
|
200
|
-
val basis = mkBasis(gdprConfig.getString("basisForProcessing")!!)
|
|
201
|
-
val docId: String = gdprConfig.getString("documentId")!!
|
|
202
|
-
val docVer: String = gdprConfig.getString("documentVersion")!!
|
|
203
|
-
val docDesc: String = gdprConfig.getString("documentDescription")!!
|
|
204
|
-
return GdprConfiguration(
|
|
205
|
-
basis,
|
|
206
|
-
docId,
|
|
207
|
-
docVer,
|
|
208
|
-
docDesc
|
|
209
|
-
)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
fun mkGCConfiguration(gcConfig: ReadableArray): GlobalContextsConfiguration {
|
|
213
|
-
val contextGens: MutableMap<String, GlobalContext> = HashMap()
|
|
214
|
-
for (i in 0 until gcConfig.size()) {
|
|
215
|
-
val gcMap: ReadableMap = gcConfig.getMap(i)
|
|
216
|
-
val itag: String = gcMap.getString("tag")!!
|
|
217
|
-
val globalContexts: ReadableArray = gcMap.getArray("globalContexts")!!
|
|
218
|
-
val staticContexts: MutableList<SelfDescribingJson> =
|
|
219
|
-
ArrayList()
|
|
220
|
-
for (x in 0 until globalContexts.size()) {
|
|
221
|
-
val gContext: SelfDescribingJson =
|
|
222
|
-
EventUtil.createSelfDescribingJson(globalContexts.getMap(x))
|
|
223
|
-
staticContexts.add(gContext)
|
|
224
|
-
}
|
|
225
|
-
val gcStatic = GlobalContext(staticContexts)
|
|
226
|
-
if (!contextGens.containsKey(itag)) {
|
|
227
|
-
contextGens[itag] = gcStatic
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return GlobalContextsConfiguration(contextGens)
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
private fun mkDevicePlatform(devPlatform: String): DevicePlatform {
|
|
234
|
-
return when (devPlatform) {
|
|
235
|
-
"web" -> DevicePlatform.Web
|
|
236
|
-
"srv" -> DevicePlatform.ServerSideApp
|
|
237
|
-
"pc" -> DevicePlatform.Desktop
|
|
238
|
-
"app" -> DevicePlatform.General
|
|
239
|
-
"tv" -> DevicePlatform.ConnectedTV
|
|
240
|
-
"cnsl" -> DevicePlatform.GameConsole
|
|
241
|
-
"iot" -> DevicePlatform.InternetOfThings
|
|
242
|
-
else -> DevicePlatform.Mobile
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
private fun mkLogLevel(logLvl: String): LogLevel {
|
|
247
|
-
return when (logLvl) {
|
|
248
|
-
"error" -> LogLevel.ERROR
|
|
249
|
-
"debug" -> LogLevel.DEBUG
|
|
250
|
-
"verbose" -> LogLevel.VERBOSE
|
|
251
|
-
else -> LogLevel.OFF
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
private fun mkBufferOption(bufferOpt: String): BufferOption? {
|
|
256
|
-
return when (bufferOpt) {
|
|
257
|
-
"single" -> BufferOption.Single
|
|
258
|
-
"small" -> BufferOption.SmallGroup
|
|
259
|
-
"large" -> BufferOption.LargeGroup
|
|
260
|
-
else -> null
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
private fun mkBasis(basis: String): Basis {
|
|
265
|
-
return when (basis) {
|
|
266
|
-
"contract" -> Basis.CONTRACT
|
|
267
|
-
"legal_obligation" -> Basis.LEGAL_OBLIGATION
|
|
268
|
-
"legitimate_interests" -> Basis.LEGITIMATE_INTERESTS
|
|
269
|
-
"public_task" -> Basis.PUBLIC_TASK
|
|
270
|
-
"vital_interests" -> Basis.VITAL_INTERESTS
|
|
271
|
-
else -> Basis.CONSENT
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
package com.snowplow.reactnativetracker.util
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReadableArray
|
|
4
|
-
import com.facebook.react.bridge.ReadableMap
|
|
5
|
-
import com.snowplowanalytics.snowplow.event.*
|
|
6
|
-
import com.snowplowanalytics.snowplow.payload.SelfDescribingJson
|
|
7
|
-
import java.util.*
|
|
8
|
-
|
|
9
|
-
object EventUtil {
|
|
10
|
-
fun createSelfDescribingJson(json: ReadableMap): SelfDescribingJson {
|
|
11
|
-
val schema: String = json.getString("schema")!!
|
|
12
|
-
val dataMap: ReadableMap = json.getMap("data")!!
|
|
13
|
-
return SelfDescribingJson(schema, dataMap.toHashMap())
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
fun createContexts(contexts: ReadableArray): List<SelfDescribingJson> {
|
|
17
|
-
val nativeContexts: MutableList<SelfDescribingJson> = ArrayList()
|
|
18
|
-
for (i in 0 until contexts.size()) {
|
|
19
|
-
val json = createSelfDescribingJson(contexts.getMap(i))
|
|
20
|
-
nativeContexts.add(json)
|
|
21
|
-
}
|
|
22
|
-
return nativeContexts
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
fun createStructuredEvent(argmap: ReadableMap): Structured {
|
|
26
|
-
val event = Structured(
|
|
27
|
-
argmap.getString("category")!!,
|
|
28
|
-
argmap.getString("action")!!
|
|
29
|
-
)
|
|
30
|
-
argmap.getString("label")?.let { event.label(it) }
|
|
31
|
-
argmap.getString("property")?.let { event.property(it) }
|
|
32
|
-
// React Native forces primitive double type - so null "value" parameter is handled by not setting at all
|
|
33
|
-
if (argmap.hasKey("value") && !argmap.isNull("value")) {
|
|
34
|
-
event.value(argmap.getDouble("value"))
|
|
35
|
-
}
|
|
36
|
-
return event
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
fun createScreenViewEvent(argmap: ReadableMap): ScreenView {
|
|
40
|
-
val name: String = argmap.getString("name")!!
|
|
41
|
-
val event = if (argmap.hasKey("id")) ScreenView(
|
|
42
|
-
name,
|
|
43
|
-
UUID.fromString(argmap.getString("id"))
|
|
44
|
-
) else ScreenView(name)
|
|
45
|
-
argmap.getString("type")?.let { event.type(it) }
|
|
46
|
-
argmap.getString("previousName")?.let { event.previousName(it) }
|
|
47
|
-
argmap.getString("previousType")?.let { event.previousType(it) }
|
|
48
|
-
argmap.getString("previousId")?.let { event.previousId(it) }
|
|
49
|
-
argmap.getString("transitionType")?.let { event.transitionType(it) }
|
|
50
|
-
return event
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
fun createScrollChangedEvent(argmap: ReadableMap): ScrollChanged {
|
|
54
|
-
val event = ScrollChanged(
|
|
55
|
-
yOffset = if (argmap.hasKey("yOffset")) { argmap.getDouble("yOffset").toInt() } else { null },
|
|
56
|
-
xOffset = if (argmap.hasKey("xOffset")) { argmap.getDouble("xOffset").toInt() } else { null },
|
|
57
|
-
viewHeight = if (argmap.hasKey("viewHeight")) { argmap.getDouble("viewHeight").toInt() } else { null },
|
|
58
|
-
viewWidth = if (argmap.hasKey("viewWidth")) { argmap.getDouble("viewWidth").toInt() } else { null },
|
|
59
|
-
contentHeight = if (argmap.hasKey("contentHeight")) { argmap.getDouble("contentHeight").toInt() } else { null },
|
|
60
|
-
contentWidth = if (argmap.hasKey("contentWidth")) { argmap.getDouble("contentWidth").toInt() } else { null },
|
|
61
|
-
)
|
|
62
|
-
return event
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
fun createListItemViewEvent(argmap: ReadableMap): ListItemView {
|
|
66
|
-
val event = ListItemView(
|
|
67
|
-
index = argmap.getDouble("index").toInt(),
|
|
68
|
-
itemsCount = if (argmap.hasKey("itemsCount")) { argmap.getDouble("itemsCount").toInt() } else { null },
|
|
69
|
-
)
|
|
70
|
-
return event
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
fun createPageViewEvent(argmap: ReadableMap): PageView {
|
|
74
|
-
val event = PageView(argmap.getString("pageUrl")!!)
|
|
75
|
-
argmap.getString("pageTitle")?.let { event.pageTitle(it) }
|
|
76
|
-
argmap.getString("referrer")?.let { event.referrer(it) }
|
|
77
|
-
return event
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
fun createTimingEvent(argmap: ReadableMap): Timing {
|
|
81
|
-
val event = Timing(
|
|
82
|
-
argmap.getString("category")!!,
|
|
83
|
-
argmap.getString("variable")!!,
|
|
84
|
-
argmap.getDouble("timing").toInt()
|
|
85
|
-
)
|
|
86
|
-
argmap.getString("label")?.let { label ->
|
|
87
|
-
event.label(label)
|
|
88
|
-
}
|
|
89
|
-
return event
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
fun createConsentGrantedEvent(argmap: ReadableMap): ConsentGranted {
|
|
93
|
-
val event = ConsentGranted(
|
|
94
|
-
argmap.getString("expiry")!!,
|
|
95
|
-
argmap.getString("documentId")!!,
|
|
96
|
-
argmap.getString("version")!!
|
|
97
|
-
)
|
|
98
|
-
argmap.getString("name")?.let { event.documentName(it) }
|
|
99
|
-
argmap.getString("documentDescription")?.let { event.documentDescription(it) }
|
|
100
|
-
return event
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
fun createConsentWithdrawnEvent(argmap: ReadableMap): ConsentWithdrawn {
|
|
104
|
-
val event = ConsentWithdrawn(
|
|
105
|
-
argmap.getBoolean("all"),
|
|
106
|
-
argmap.getString("documentId")!!,
|
|
107
|
-
argmap.getString("version")!!
|
|
108
|
-
)
|
|
109
|
-
argmap.getString("name")?.let { event.documentName(it) }
|
|
110
|
-
argmap.getString("documentDescription")?.let { event.documentDescription(it) }
|
|
111
|
-
return event
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
fun createEcommerceTransactionItems(items: ReadableArray): List<EcommerceTransactionItem> {
|
|
115
|
-
val ecomItems: MutableList<EcommerceTransactionItem> = ArrayList()
|
|
116
|
-
for (i in 0 until items.size()) {
|
|
117
|
-
val argItem: ReadableMap = items.getMap(i)
|
|
118
|
-
val item = EcommerceTransactionItem(
|
|
119
|
-
argItem.getString("sku")!!,
|
|
120
|
-
argItem.getDouble("price"),
|
|
121
|
-
argItem.getDouble("quantity").toInt()
|
|
122
|
-
)
|
|
123
|
-
argItem.getString("name")?.let { item.name(it) }
|
|
124
|
-
argItem.getString("category")?.let { item.category(it) }
|
|
125
|
-
argItem.getString("currency")?.let { item.currency(it) }
|
|
126
|
-
ecomItems.add(item)
|
|
127
|
-
}
|
|
128
|
-
return ecomItems
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
fun createEcommerceTransactionEvent(argmap: ReadableMap): EcommerceTransaction {
|
|
132
|
-
val ecomItems = createEcommerceTransactionItems(
|
|
133
|
-
argmap.getArray("items")!!
|
|
134
|
-
)
|
|
135
|
-
val event = EcommerceTransaction(
|
|
136
|
-
argmap.getString("orderId")!!,
|
|
137
|
-
argmap.getDouble("totalValue"),
|
|
138
|
-
ecomItems
|
|
139
|
-
)
|
|
140
|
-
argmap.getString("affiliation")?.let { event.affiliation(it) }
|
|
141
|
-
if (argmap.hasKey("taxValue")) {
|
|
142
|
-
event.taxValue(argmap.getDouble("taxValue"))
|
|
143
|
-
}
|
|
144
|
-
if (argmap.hasKey("shipping")) {
|
|
145
|
-
event.shipping(argmap.getDouble("shipping"))
|
|
146
|
-
}
|
|
147
|
-
argmap.getString("city")?.let { event.city(it) }
|
|
148
|
-
argmap.getString("state")?.let { event.state(it) }
|
|
149
|
-
argmap.getString("country")?.let { event.country(it) }
|
|
150
|
-
argmap.getString("currency")?.let { event.currency(it) }
|
|
151
|
-
return event
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
fun createDeepLinkReceivedEvent(argmap: ReadableMap): DeepLinkReceived {
|
|
155
|
-
val event = DeepLinkReceived(
|
|
156
|
-
argmap.getString("url")!!
|
|
157
|
-
)
|
|
158
|
-
argmap.getString("referrer")?.let { event.referrer(it) }
|
|
159
|
-
return event
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
fun createMessageNotificationAttachments(items: ReadableArray): List<MessageNotificationAttachment> {
|
|
163
|
-
val attachments: MutableList<MessageNotificationAttachment> = ArrayList()
|
|
164
|
-
for (i in 0 until items.size()) {
|
|
165
|
-
val argItem: ReadableMap = items.getMap(i)
|
|
166
|
-
val attachment = MessageNotificationAttachment(
|
|
167
|
-
argItem.getString("identifier")!!,
|
|
168
|
-
argItem.getString("type")!!,
|
|
169
|
-
argItem.getString("url")!!
|
|
170
|
-
)
|
|
171
|
-
attachments.add(attachment)
|
|
172
|
-
}
|
|
173
|
-
return attachments
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
fun createStrings(items: ReadableArray): List<String> {
|
|
177
|
-
val results: MutableList<String> = ArrayList()
|
|
178
|
-
for (i in 0 until items.size()) {
|
|
179
|
-
results.add(items.getString(i))
|
|
180
|
-
}
|
|
181
|
-
return results
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
fun createMessageNotificationEvent(argmap: ReadableMap): MessageNotification {
|
|
185
|
-
val trigger: MessageNotificationTrigger
|
|
186
|
-
trigger =
|
|
187
|
-
when (argmap.getString("trigger")!!) {
|
|
188
|
-
"push" -> MessageNotificationTrigger.push
|
|
189
|
-
"location" -> MessageNotificationTrigger.location
|
|
190
|
-
"calendar" -> MessageNotificationTrigger.calendar
|
|
191
|
-
"timeInterval" -> MessageNotificationTrigger.timeInterval
|
|
192
|
-
else -> MessageNotificationTrigger.other
|
|
193
|
-
}
|
|
194
|
-
val event = MessageNotification(
|
|
195
|
-
argmap.getString("title")!!,
|
|
196
|
-
argmap.getString("body")!!,
|
|
197
|
-
trigger
|
|
198
|
-
)
|
|
199
|
-
argmap.getString("action")?.let { event.action(it) }
|
|
200
|
-
if (argmap.hasKey("attachments")) {
|
|
201
|
-
argmap.getArray("attachments")?.let { attachments ->
|
|
202
|
-
event.attachments(createMessageNotificationAttachments(attachments))
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
if (argmap.hasKey("bodyLocArgs")) {
|
|
206
|
-
argmap.getArray("bodyLocArgs")?.let { bodyLocArgs ->
|
|
207
|
-
event.bodyLocArgs(createStrings(bodyLocArgs))
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
argmap.getString("bodyLocKey")?.let { event.bodyLocKey(it) }
|
|
211
|
-
argmap.getString("category")?.let { event.category(it) }
|
|
212
|
-
if (argmap.hasKey("contentAvailable")) {
|
|
213
|
-
event.contentAvailable(argmap.getBoolean("contentAvailable"))
|
|
214
|
-
}
|
|
215
|
-
argmap.getString("group")?.let { event.group(it) }
|
|
216
|
-
argmap.getString("icon")?.let { event.icon(it) }
|
|
217
|
-
if (argmap.hasKey("notificationCount")) {
|
|
218
|
-
event.notificationCount(argmap.getDouble("notificationCount").toInt())
|
|
219
|
-
}
|
|
220
|
-
argmap.getString("notificationTimestamp")?.let { event.notificationTimestamp(it) }
|
|
221
|
-
argmap.getString("sound")?.let { event.sound(it) }
|
|
222
|
-
argmap.getString("subtitle")?.let { event.subtitle(it) }
|
|
223
|
-
argmap.getString("tag")?.let { event.tag(it) }
|
|
224
|
-
argmap.getString("threadIdentifier")?.let { event.threadIdentifier(it) }
|
|
225
|
-
if (argmap.hasKey("titleLocArgs")) {
|
|
226
|
-
argmap.getArray("titleLocArgs")?.let { titleLocArgs ->
|
|
227
|
-
event.titleLocArgs(createStrings(titleLocArgs))
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
argmap.getString("titleLocKey")?.let { event.titleLocKey(it) }
|
|
231
|
-
return event
|
|
232
|
-
}
|
|
233
|
-
}
|
package/babel.config.js
DELETED
package/example/.watchmanconfig
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{}
|
package/example/Gemfile
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
apply plugin: "com.android.application"
|
|
2
|
-
apply plugin: "com.facebook.react"
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* This is the configuration block to customize your React Native Android app.
|
|
6
|
-
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
|
7
|
-
*/
|
|
8
|
-
react {
|
|
9
|
-
/* Folders */
|
|
10
|
-
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
|
11
|
-
// root = file("../")
|
|
12
|
-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
|
13
|
-
// reactNativeDir = file("../node_modules/react-native")
|
|
14
|
-
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
|
|
15
|
-
// codegenDir = file("../node_modules/@react-native/codegen")
|
|
16
|
-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
|
|
17
|
-
// cliFile = file("../node_modules/react-native/cli.js")
|
|
18
|
-
|
|
19
|
-
/* Variants */
|
|
20
|
-
// The list of variants to that are debuggable. For those we're going to
|
|
21
|
-
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
|
22
|
-
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
23
|
-
// debuggableVariants = ["liteDebug", "prodDebug"]
|
|
24
|
-
|
|
25
|
-
/* Bundling */
|
|
26
|
-
// A list containing the node command and its flags. Default is just 'node'.
|
|
27
|
-
// nodeExecutableAndArgs = ["node"]
|
|
28
|
-
//
|
|
29
|
-
// The command to run when bundling. By default is 'bundle'
|
|
30
|
-
// bundleCommand = "ram-bundle"
|
|
31
|
-
//
|
|
32
|
-
// The path to the CLI configuration file. Default is empty.
|
|
33
|
-
// bundleConfig = file(../rn-cli.config.js)
|
|
34
|
-
//
|
|
35
|
-
// The name of the generated asset file containing your JS bundle
|
|
36
|
-
// bundleAssetName = "MyApplication.android.bundle"
|
|
37
|
-
//
|
|
38
|
-
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
39
|
-
// entryFile = file("../js/MyApplication.android.js")
|
|
40
|
-
//
|
|
41
|
-
// A list of extra flags to pass to the 'bundle' commands.
|
|
42
|
-
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
43
|
-
// extraPackagerArgs = []
|
|
44
|
-
|
|
45
|
-
/* Hermes Commands */
|
|
46
|
-
// The hermes compiler command to run. By default it is 'hermesc'
|
|
47
|
-
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
|
48
|
-
//
|
|
49
|
-
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
50
|
-
// hermesFlags = ["-O", "-output-source-map"]
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
55
|
-
*/
|
|
56
|
-
def enableProguardInReleaseBuilds = false
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The preferred build flavor of JavaScriptCore (JSC)
|
|
60
|
-
*
|
|
61
|
-
* For example, to use the international variant, you can use:
|
|
62
|
-
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
|
63
|
-
*
|
|
64
|
-
* The international variant includes ICU i18n library and necessary data
|
|
65
|
-
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
66
|
-
* give correct results when using with locales other than en-US. Note that
|
|
67
|
-
* this variant is about 6MiB larger per architecture than default.
|
|
68
|
-
*/
|
|
69
|
-
def jscFlavor = 'org.webkit:android-jsc:+'
|
|
70
|
-
|
|
71
|
-
android {
|
|
72
|
-
ndkVersion rootProject.ext.ndkVersion
|
|
73
|
-
|
|
74
|
-
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
75
|
-
|
|
76
|
-
namespace "com.reactnativetrackerexample"
|
|
77
|
-
defaultConfig {
|
|
78
|
-
applicationId "com.reactnativetrackerexample"
|
|
79
|
-
minSdkVersion rootProject.ext.minSdkVersion
|
|
80
|
-
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
81
|
-
versionCode 1
|
|
82
|
-
versionName "1.0"
|
|
83
|
-
testBuildType System.getProperty('testBuildType', 'debug')
|
|
84
|
-
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
|
85
|
-
}
|
|
86
|
-
signingConfigs {
|
|
87
|
-
debug {
|
|
88
|
-
storeFile file('debug.keystore')
|
|
89
|
-
storePassword 'android'
|
|
90
|
-
keyAlias 'androiddebugkey'
|
|
91
|
-
keyPassword 'android'
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
buildTypes {
|
|
95
|
-
debug {
|
|
96
|
-
signingConfig signingConfigs.debug
|
|
97
|
-
}
|
|
98
|
-
release {
|
|
99
|
-
// Caution! In production, you need to generate your own keystore file.
|
|
100
|
-
// see https://reactnative.dev/docs/signed-apk-android.
|
|
101
|
-
signingConfig signingConfigs.debug
|
|
102
|
-
minifyEnabled enableProguardInReleaseBuilds
|
|
103
|
-
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
104
|
-
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
dependencies {
|
|
110
|
-
// The version of react-native is set by the React Native Gradle Plugin
|
|
111
|
-
implementation("com.facebook.react:react-android")
|
|
112
|
-
|
|
113
|
-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
|
114
|
-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
115
|
-
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
119
|
-
if (hermesEnabled.toBoolean()) {
|
|
120
|
-
implementation("com.facebook.react:hermes-android")
|
|
121
|
-
} else {
|
|
122
|
-
implementation jscFlavor
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
androidTestImplementation 'com.wix:detox:+'
|
|
126
|
-
implementation 'androidx.appcompat:appcompat:1.1.0'
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
|
|
Binary file
|