mapp-intelligence-reactnative-plugin 1.1.0 → 1.1.1
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/android/build.gradle +19 -8
- package/android/gradle.properties +2 -2
- package/android/settings.gradle +24 -0
- package/android/specs/MappinteligencePluginSpec.js +8 -0
- package/android/src/main/AndroidManifest.xml +3 -1
- package/android/src/main/java/com/mappinteligenceplugin/MappinteligencePluginModule.kt +291 -262
- package/android/src/main/java/com/mappinteligenceplugin/MappinteligencePluginPackage.kt +18 -7
- package/android/src/main/java/com/mappinteligenceplugin/MappintelligencePluginSpec.kt +59 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/Info.plist +48 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIActionEvent.h +33 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MICampaignParameters.h +32 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIDefaultTracker.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIEcommerceParameters.h +52 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIEventParameters.h +23 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIFormField.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIFormParameters.h +48 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIFormSubmitEvent.h +22 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIMediaEvent.h +30 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIMediaParameters.h +31 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIPageParameters.h +27 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIPageViewEvent.h +34 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIParamType.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIParams.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIProduct.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIProperties.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MISessionParameters.h +20 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MITrackerRequest.h +39 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MITrackingEvent.h +23 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIUsageStatistics.h +32 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MIUserCategories.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MappIntelligence.h +260 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceSDK/MappIntelligenceSDK.h +9 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIActionEvent.h +33 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MICampaignParameters.h +32 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIDefaultTracker.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIEcommerceParameters.h +52 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIEventParameters.h +23 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIFormField.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIFormParameters.h +48 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIFormSubmitEvent.h +22 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIMediaEvent.h +30 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIMediaParameters.h +31 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIPageParameters.h +27 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIPageViewEvent.h +34 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIParamType.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIParams.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIProduct.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MISessionParameters.h +20 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MITrackingEvent.h +23 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIUsageStatistics.h +32 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIUserCategories.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MIWebViewTracker.h +21 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MappIntelligence.h +260 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MappIntelligenceLogger.h +47 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/Headers/MappIntelligenceiOS/MappIntelligenceiOS.h +13 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64/libMappIntelligenceiOS.a +0 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIActionEvent.h +33 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MICampaignParameters.h +32 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIDefaultTracker.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIEcommerceParameters.h +52 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIEventParameters.h +23 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIFormField.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIFormParameters.h +48 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIFormSubmitEvent.h +22 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIMediaEvent.h +30 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIMediaParameters.h +31 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIPageParameters.h +27 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIPageViewEvent.h +34 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIParamType.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIParams.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIProduct.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIProperties.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MISessionParameters.h +20 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MITrackerRequest.h +39 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MITrackingEvent.h +23 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIUsageStatistics.h +32 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MIUserCategories.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MappIntelligence.h +260 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceSDK/MappIntelligenceSDK.h +9 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIActionEvent.h +33 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MICampaignParameters.h +32 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIDefaultTracker.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIEcommerceParameters.h +52 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIEventParameters.h +23 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIFormField.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIFormParameters.h +48 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIFormSubmitEvent.h +22 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIMediaEvent.h +30 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIMediaParameters.h +31 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIPageParameters.h +27 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIPageViewEvent.h +34 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIParamType.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIParams.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIProduct.h +28 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MISessionParameters.h +20 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MITrackingEvent.h +23 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIUsageStatistics.h +32 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIUserCategories.h +49 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MIWebViewTracker.h +21 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MappIntelligence.h +260 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MappIntelligenceLogger.h +47 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/Headers/MappIntelligenceiOS/MappIntelligenceiOS.h +13 -0
- package/ios/Frameworks/MappIntelligenceiOS.xcframework/ios-arm64_x86_64-simulator/libMappIntelligenceiOS.a +0 -0
- package/lib/module/GlobalErrorHandler.js +6 -11
- package/lib/module/GlobalErrorHandler.js.map +1 -1
- package/lib/module/MappIntelligencePlugin.js +6 -2
- package/lib/module/MappIntelligencePlugin.js.map +1 -1
- package/lib/module/NativeMappintelligencePlugin.js +5 -0
- package/lib/module/NativeMappintelligencePlugin.js.map +1 -0
- package/lib/module/UseWebTracking.js +20 -20
- package/lib/module/UseWebTracking.js.map +1 -1
- package/lib/module/promiseRejectionHandler.js +4 -9
- package/lib/module/promiseRejectionHandler.js.map +1 -1
- package/lib/typescript/src/GlobalErrorHandler.d.ts.map +1 -1
- package/lib/typescript/src/MappIntelligencePlugin.d.ts.map +1 -1
- package/lib/typescript/src/NativeMappintelligencePlugin.d.ts +39 -0
- package/lib/typescript/src/NativeMappintelligencePlugin.d.ts.map +1 -0
- package/lib/typescript/src/UseWebTracking.d.ts +1 -1
- package/lib/typescript/src/UseWebTracking.d.ts.map +1 -1
- package/lib/typescript/src/promiseRejectionHandler.d.ts.map +1 -1
- package/mapp-intelligence-reactnative-plugin.podspec +4 -1
- package/package.json +20 -41
- package/src/GlobalErrorHandler.tsx +7 -12
- package/src/MappIntelligencePlugin.tsx +16 -11
- package/src/NativeMappintelligencePlugin.ts +55 -0
- package/src/UseWebTracking.tsx +29 -27
- package/src/promiseRejectionHandler.tsx +5 -10
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
package com.mappinteligenceplugin
|
|
2
2
|
|
|
3
|
-
import android.net.Uri
|
|
4
3
|
import android.util.Log
|
|
5
4
|
import androidx.annotation.IntRange
|
|
5
|
+
import androidx.core.net.toUri
|
|
6
6
|
import com.facebook.react.bridge.Promise
|
|
7
7
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
9
8
|
import com.facebook.react.bridge.ReactMethod
|
|
10
9
|
import com.facebook.react.bridge.ReadableArray
|
|
11
10
|
import com.facebook.react.bridge.ReadableMap
|
|
11
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
12
12
|
import com.mappinteligenceplugin.mapper.CampaignParametersMapper
|
|
13
13
|
import com.mappinteligenceplugin.mapper.ECommerceParametersMapper
|
|
14
14
|
import com.mappinteligenceplugin.mapper.EventParametersMapper
|
|
@@ -18,266 +18,256 @@ import com.mappinteligenceplugin.mapper.PageParametersMapper
|
|
|
18
18
|
import com.mappinteligenceplugin.mapper.SessionParametersMapper
|
|
19
19
|
import com.mappinteligenceplugin.mapper.UserCategoriesMapper
|
|
20
20
|
import com.mappinteligenceplugin.mapper.Util.toMap
|
|
21
|
+
import java.util.concurrent.TimeUnit
|
|
21
22
|
import webtrekk.android.sdk.Logger
|
|
22
23
|
import webtrekk.android.sdk.Webtrekk
|
|
23
24
|
import webtrekk.android.sdk.WebtrekkConfiguration
|
|
24
25
|
import webtrekk.android.sdk.events.ActionEvent
|
|
25
26
|
import webtrekk.android.sdk.events.PageViewEvent
|
|
26
|
-
import java.util.concurrent.TimeUnit
|
|
27
27
|
|
|
28
|
+
@ReactModule(name = MappinteligencePluginModule.NAME)
|
|
28
29
|
class MappinteligencePluginModule(private val reactContext: ReactApplicationContext) :
|
|
29
|
-
|
|
30
|
+
NativeMappintelligencePluginSpec(reactContext) {
|
|
31
|
+
|
|
32
|
+
companion object {
|
|
33
|
+
const val NAME = "MappinteligencePlugin"
|
|
34
|
+
private val configAdapter: ConfigAdapter by lazy { ConfigAdapter() }
|
|
35
|
+
}
|
|
30
36
|
|
|
31
|
-
private
|
|
32
|
-
|
|
37
|
+
private var instance: Webtrekk? = null
|
|
38
|
+
|
|
39
|
+
init {
|
|
40
|
+
println("MappIntelligencePluginModule created!")
|
|
41
|
+
println("MappIntelligence instance: $instance")
|
|
42
|
+
}
|
|
33
43
|
|
|
34
44
|
/**
|
|
35
|
-
* Initialize native SDK with the provided trackIds and trackDomain and with the default other
|
|
45
|
+
* Initialize native SDK with the provided trackIds and trackDomain and with the default other
|
|
46
|
+
* parameters
|
|
36
47
|
*/
|
|
37
48
|
@ReactMethod
|
|
38
|
-
fun initWithConfiguration(
|
|
49
|
+
override fun initWithConfiguration(
|
|
50
|
+
trackIds: ReadableArray,
|
|
51
|
+
trackDomain: String,
|
|
52
|
+
promise: Promise
|
|
53
|
+
) {
|
|
39
54
|
val trackValues = mutableListOf<Double?>()
|
|
40
55
|
for (i in 0 until trackIds.size()) {
|
|
41
56
|
trackValues.add(trackIds.getDouble(i))
|
|
42
57
|
}
|
|
43
58
|
val ids = trackValues.mapNotNull { it?.toBigDecimal()?.toPlainString() }
|
|
44
|
-
runOnPlugin(
|
|
45
|
-
instance
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
runOnPlugin(
|
|
60
|
+
whenInitialized = { instance?.setIdsAndDomain(ids, trackDomain) },
|
|
61
|
+
whenNotInitialized = {
|
|
62
|
+
configAdapter.trackIds = ids
|
|
63
|
+
configAdapter.trackDomain = trackDomain
|
|
64
|
+
}
|
|
65
|
+
)
|
|
50
66
|
promise.resolve(true)
|
|
51
67
|
}
|
|
52
68
|
|
|
53
69
|
/**
|
|
54
|
-
* Check if SDK is initialized and ready for usage
|
|
55
|
-
*
|
|
70
|
+
* Check if SDK is initialized and ready for usage Returns true if initialization was finished,
|
|
71
|
+
* otherwise false
|
|
56
72
|
*/
|
|
57
73
|
@ReactMethod
|
|
58
|
-
fun isInitialized(promise: Promise) {
|
|
59
|
-
runOnPlugin(
|
|
60
|
-
promise.resolve(true)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
})
|
|
74
|
+
override fun isInitialized(promise: Promise) {
|
|
75
|
+
runOnPlugin(
|
|
76
|
+
whenInitialized = { promise.resolve(true) },
|
|
77
|
+
whenNotInitialized = { promise.resolve(false) }
|
|
78
|
+
)
|
|
64
79
|
}
|
|
65
80
|
|
|
66
81
|
/**
|
|
67
|
-
* Enable or disable anonymous tracking
|
|
68
|
-
*
|
|
82
|
+
* Enable or disable anonymous tracking When anonymous tracking is enabled, everId will be deleted
|
|
83
|
+
* and not created again while this value stays true
|
|
69
84
|
*/
|
|
70
85
|
@ReactMethod
|
|
71
|
-
fun setAnonymousTracking(enabled: Boolean, promise: Promise) {
|
|
86
|
+
override fun setAnonymousTracking(enabled: Boolean, promise: Promise) {
|
|
72
87
|
runOnPlugin(
|
|
73
|
-
whenInitialized = {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
configAdapter.anonymousTracking = enabled
|
|
77
|
-
})
|
|
88
|
+
whenInitialized = { instance?.anonymousTracking(enabled) },
|
|
89
|
+
whenNotInitialized = { configAdapter.anonymousTracking = enabled }
|
|
90
|
+
)
|
|
78
91
|
promise.resolve(true)
|
|
79
92
|
}
|
|
80
93
|
|
|
81
|
-
/**
|
|
82
|
-
* Enable or disable sending appVersion parameter with a every request
|
|
83
|
-
*/
|
|
94
|
+
/** Enable or disable sending appVersion parameter with a every request */
|
|
84
95
|
@ReactMethod
|
|
85
|
-
fun setSendAppVersionInEveryRequest(enabled: Boolean, promise: Promise) {
|
|
86
|
-
runOnPlugin(
|
|
87
|
-
instance
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
})
|
|
96
|
+
override fun setSendAppVersionInEveryRequest(enabled: Boolean, promise: Promise) {
|
|
97
|
+
runOnPlugin(
|
|
98
|
+
whenInitialized = { instance?.setVersionInEachRequest(enabled) },
|
|
99
|
+
whenNotInitialized = { configAdapter.versionInEachRequest = enabled }
|
|
100
|
+
)
|
|
91
101
|
promise.resolve(true)
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
/**
|
|
95
|
-
* Enable or disable user matching option
|
|
96
|
-
*
|
|
105
|
+
* Enable or disable user matching option User matching provides connection between users on
|
|
106
|
+
* Engage and Intelligence systems
|
|
97
107
|
*/
|
|
98
108
|
@ReactMethod
|
|
99
|
-
fun setEnableUserMatching(enabled: Boolean, promise: Promise) {
|
|
100
|
-
runOnPlugin(
|
|
101
|
-
instance
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
})
|
|
109
|
+
override fun setEnableUserMatching(enabled: Boolean, promise: Promise) {
|
|
110
|
+
runOnPlugin(
|
|
111
|
+
whenInitialized = { instance?.setUserMatchingEnabled(enabled) },
|
|
112
|
+
whenNotInitialized = { configAdapter.userMatchingEnabled = enabled }
|
|
113
|
+
)
|
|
105
114
|
promise.resolve(true)
|
|
106
115
|
}
|
|
107
116
|
|
|
108
117
|
/**
|
|
109
|
-
* Set custom everId
|
|
110
|
-
*
|
|
111
|
-
* <b>It has effect only if anonymous tracking is disabled</b>
|
|
118
|
+
* Set custom everId If null or empty string passed, everId will be autogenerated <b>It has effect
|
|
119
|
+
* only if anonymous tracking is disabled</b>
|
|
112
120
|
*/
|
|
113
121
|
@ReactMethod
|
|
114
|
-
fun setEverId(everId: String?, promise: Promise) {
|
|
115
|
-
runOnPlugin(
|
|
116
|
-
instance
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
})
|
|
122
|
+
override fun setEverId(everId: String?, promise: Promise) {
|
|
123
|
+
runOnPlugin(
|
|
124
|
+
whenInitialized = { instance?.setEverId(everId) },
|
|
125
|
+
whenNotInitialized = { configAdapter.everId = everId }
|
|
126
|
+
)
|
|
120
127
|
promise.resolve(true)
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
@ReactMethod
|
|
124
|
-
fun getEverId(promise: Promise) {
|
|
125
|
-
runOnPlugin(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
override fun getEverId(promise: Promise) {
|
|
132
|
+
runOnPlugin(
|
|
133
|
+
whenInitialized = {
|
|
134
|
+
val everId = instance?.getEverId()
|
|
135
|
+
promise.resolve(everId)
|
|
136
|
+
},
|
|
137
|
+
whenNotInitialized = { promise.reject("", "SDK not initialized yet!") }
|
|
138
|
+
)
|
|
131
139
|
}
|
|
132
140
|
|
|
133
141
|
@ReactMethod
|
|
134
|
-
fun setTemporarySessionId(sessionId: String
|
|
135
|
-
runOnPlugin(
|
|
136
|
-
instance
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
142
|
+
override fun setTemporarySessionId(sessionId: String?, promise: Promise) {
|
|
143
|
+
runOnPlugin(
|
|
144
|
+
whenInitialized = { instance?.setTemporarySessionId(sessionId ?: "") },
|
|
145
|
+
whenNotInitialized = { configAdapter.temporarySessionId = sessionId ?: "" }
|
|
146
|
+
)
|
|
140
147
|
promise.resolve(true)
|
|
141
148
|
}
|
|
142
149
|
|
|
143
150
|
@ReactMethod
|
|
144
|
-
fun optOut(sendData: Boolean, promise: Promise) {
|
|
145
|
-
runOnPlugin(whenInitialized = {
|
|
146
|
-
instance.optOut(true, sendData)
|
|
147
|
-
})
|
|
151
|
+
override fun optOut(sendData: Boolean, promise: Promise) {
|
|
152
|
+
runOnPlugin(whenInitialized = { instance?.optOut(true, sendData) })
|
|
148
153
|
promise.resolve(true)
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
@ReactMethod
|
|
152
|
-
fun optIn(sendData: Boolean, promise: Promise) {
|
|
153
|
-
runOnPlugin(whenInitialized = {
|
|
154
|
-
instance.optOut(false, sendData)
|
|
155
|
-
})
|
|
157
|
+
override fun optIn(sendData: Boolean, promise: Promise) {
|
|
158
|
+
runOnPlugin(whenInitialized = { instance?.optOut(false, sendData) })
|
|
156
159
|
promise.resolve(true)
|
|
157
160
|
}
|
|
158
161
|
|
|
159
162
|
@ReactMethod
|
|
160
|
-
fun setExceptionLogLevel(exceptionLevel: Double, promise: Promise) {
|
|
163
|
+
override fun setExceptionLogLevel(exceptionLevel: Double, promise: Promise) {
|
|
161
164
|
val exceptionType = ExceptionTypeMapper(exceptionLevel).getData()
|
|
162
|
-
runOnPlugin(
|
|
163
|
-
instance
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
165
|
+
runOnPlugin(
|
|
166
|
+
whenInitialized = { instance?.setExceptionLogLevel(exceptionType) },
|
|
167
|
+
whenNotInitialized = { configAdapter.exceptionLogLevel = exceptionType }
|
|
168
|
+
)
|
|
167
169
|
promise.resolve(true)
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
/**
|
|
171
|
-
* Sets log level for a library. Disable or enable logs in the logcat from the intelligence SDK
|
|
173
|
+
* Sets log level for a library. Disable or enable logs in the logcat from the intelligence SDK
|
|
174
|
+
* and it's plugin
|
|
172
175
|
*/
|
|
173
176
|
@ReactMethod
|
|
174
|
-
fun setLogLevel(level:
|
|
175
|
-
val
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
override fun setLogLevel(level: Double, promise: Promise) {
|
|
178
|
+
val levelInt = level.toInt()
|
|
179
|
+
val nativeLevel =
|
|
180
|
+
if (levelInt == 7) {
|
|
181
|
+
Logger.Level.NONE
|
|
182
|
+
} else {
|
|
183
|
+
Logger.Level.BASIC
|
|
184
|
+
}
|
|
185
|
+
runOnPlugin(
|
|
186
|
+
whenInitialized = { instance?.setLogLevel(nativeLevel) },
|
|
187
|
+
whenNotInitialized = { configAdapter.logLevel = nativeLevel }
|
|
188
|
+
)
|
|
185
189
|
promise.resolve(true)
|
|
186
190
|
}
|
|
187
191
|
|
|
188
|
-
|
|
189
192
|
/**
|
|
190
|
-
* Enable or disable sending requests in a batch
|
|
191
|
-
*
|
|
193
|
+
* Enable or disable sending requests in a batch When enabled, multiple track records are send via
|
|
194
|
+
* single Http request
|
|
192
195
|
*/
|
|
193
196
|
@ReactMethod
|
|
194
|
-
fun setBatchSupportEnabled(enabled: Boolean, promise: Promise) {
|
|
195
|
-
runOnPlugin(
|
|
196
|
-
instance
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
})
|
|
197
|
+
override fun setBatchSupportEnabled(enabled: Boolean, promise: Promise) {
|
|
198
|
+
runOnPlugin(
|
|
199
|
+
whenInitialized = { instance?.setBatchEnabled(enabled) },
|
|
200
|
+
whenNotInitialized = { configAdapter.batchSupport = enabled }
|
|
201
|
+
)
|
|
200
202
|
promise.resolve(true)
|
|
201
203
|
}
|
|
202
204
|
|
|
203
205
|
/**
|
|
204
|
-
* Sets the number of records to be send in a single network request.
|
|
205
|
-
*
|
|
206
|
+
* Sets the number of records to be send in a single network request. Value must be in the defined
|
|
207
|
+
* range for size
|
|
206
208
|
*/
|
|
207
209
|
@ReactMethod
|
|
208
|
-
fun setBatchSupportSize(
|
|
209
|
-
|
|
210
|
-
) {
|
|
210
|
+
override fun setBatchSupportSize(size: Double, promise: Promise) {
|
|
211
|
+
val sizeInt = size.toInt()
|
|
211
212
|
runOnPlugin(
|
|
212
|
-
whenInitialized = {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
configAdapter.requestPerBatch = size
|
|
216
|
-
})
|
|
213
|
+
whenInitialized = { instance?.setRequestPerBatch(sizeInt) },
|
|
214
|
+
whenNotInitialized = { configAdapter.requestPerBatch = sizeInt }
|
|
215
|
+
)
|
|
217
216
|
promise.resolve(true)
|
|
218
217
|
}
|
|
219
218
|
|
|
220
219
|
/**
|
|
221
|
-
* Sets time interval, in minutes, for a job of automatic sending of the tracking records
|
|
222
|
-
*
|
|
220
|
+
* Sets time interval, in minutes, for a job of automatic sending of the tracking records Minimum
|
|
221
|
+
* value is 15 minutes, limited by Android OS.
|
|
223
222
|
*/
|
|
224
223
|
@ReactMethod
|
|
225
|
-
fun setRequestInterval(
|
|
226
|
-
|
|
227
|
-
) {
|
|
224
|
+
override fun setRequestInterval(interval: Double, promise: Promise) {
|
|
225
|
+
val intervalInt = interval.toInt()
|
|
228
226
|
runOnPlugin(
|
|
229
|
-
whenInitialized = {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
configAdapter.requestsIntervalMinutes = interval
|
|
233
|
-
})
|
|
227
|
+
whenInitialized = { instance?.setRequestInterval(intervalInt.toLong()) },
|
|
228
|
+
whenNotInitialized = { configAdapter.requestsIntervalMinutes = intervalInt }
|
|
229
|
+
)
|
|
234
230
|
promise.resolve(true)
|
|
235
231
|
}
|
|
236
232
|
|
|
237
|
-
/**
|
|
238
|
-
* This operation is not supported on android
|
|
239
|
-
* Method exists only for compatibility
|
|
240
|
-
*/
|
|
233
|
+
/** This operation is not supported on android Method exists only for compatibility */
|
|
241
234
|
@ReactMethod
|
|
242
|
-
fun setRequestPerQueue(queue:
|
|
235
|
+
override fun setRequestPerQueue(queue: Double, promise: Promise) {
|
|
243
236
|
promise.resolve(true)
|
|
244
237
|
}
|
|
245
238
|
|
|
246
239
|
/**
|
|
247
|
-
* Enable or disable migration from previous version of a native SDK
|
|
248
|
-
*
|
|
249
|
-
*
|
|
240
|
+
* Enable or disable migration from previous version of a native SDK React Native plugin was not
|
|
241
|
+
* developed with a older version (v4) of the native plugin, so migration for this plugin will
|
|
242
|
+
* always stay false.
|
|
250
243
|
*/
|
|
251
244
|
@ReactMethod
|
|
252
|
-
fun setShouldMigrate(migrate: Boolean, promise: Promise) {
|
|
245
|
+
override fun setShouldMigrate(migrate: Boolean, promise: Promise) {
|
|
253
246
|
runOnPlugin(
|
|
254
247
|
whenInitialized = {
|
|
255
248
|
if (migrate) {
|
|
256
249
|
reset { it.enableMigration() }
|
|
257
250
|
}
|
|
258
|
-
},
|
|
259
|
-
|
|
260
|
-
|
|
251
|
+
},
|
|
252
|
+
whenNotInitialized = { configAdapter.shouldMigrate = migrate }
|
|
253
|
+
)
|
|
261
254
|
promise.resolve(true)
|
|
262
255
|
}
|
|
263
256
|
|
|
264
|
-
/**
|
|
265
|
-
* Required only for iOS;
|
|
266
|
-
* Method just returns success and exist only for compatibility
|
|
267
|
-
*/
|
|
257
|
+
/** Required only for iOS; Method just returns success and exist only for compatibility */
|
|
268
258
|
@ReactMethod
|
|
269
|
-
fun setEnableBackgroundSendout(enabled: Boolean, promise: Promise) {
|
|
259
|
+
override fun setEnableBackgroundSendout(enabled: Boolean, promise: Promise) {
|
|
270
260
|
promise.resolve(true)
|
|
271
261
|
}
|
|
272
262
|
|
|
273
263
|
@ReactMethod
|
|
274
|
-
fun trackCustomPage(
|
|
275
|
-
pageTitle: String
|
|
276
|
-
pageParams: ReadableMap
|
|
277
|
-
sessionParams: ReadableMap
|
|
278
|
-
userCategoryParams: ReadableMap
|
|
279
|
-
ecommerceParams: ReadableMap
|
|
280
|
-
campaignParams: ReadableMap
|
|
264
|
+
override fun trackCustomPage(
|
|
265
|
+
pageTitle: String?,
|
|
266
|
+
pageParams: ReadableMap,
|
|
267
|
+
sessionParams: ReadableMap,
|
|
268
|
+
userCategoryParams: ReadableMap,
|
|
269
|
+
ecommerceParams: ReadableMap,
|
|
270
|
+
campaignParams: ReadableMap,
|
|
281
271
|
promise: Promise
|
|
282
272
|
) {
|
|
283
273
|
runOnPlugin(
|
|
@@ -288,55 +278,52 @@ class MappinteligencePluginModule(private val reactContext: ReactApplicationCont
|
|
|
288
278
|
val ecommerce = ECommerceParametersMapper(ecommerceParams).getData()
|
|
289
279
|
val campaign = CampaignParametersMapper(campaignParams).getData()
|
|
290
280
|
|
|
291
|
-
val pageViewEvent =
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
281
|
+
val pageViewEvent =
|
|
282
|
+
PageViewEvent(pageTitle ?: "NO_NAME_PAGE").apply {
|
|
283
|
+
this.pageParameters = page
|
|
284
|
+
this.sessionParameters = session
|
|
285
|
+
this.userCategories = userCat
|
|
286
|
+
this.eCommerceParameters = ecommerce
|
|
287
|
+
this.campaignParameters = campaign
|
|
288
|
+
}
|
|
289
|
+
instance?.trackPage(pageViewEvent)
|
|
299
290
|
}
|
|
300
291
|
)
|
|
301
292
|
promise.resolve(true)
|
|
302
293
|
}
|
|
303
294
|
|
|
304
|
-
/**
|
|
305
|
-
* Track page with a provided [PageViewEvent]
|
|
306
|
-
*/
|
|
295
|
+
/** Track page with a provided [PageViewEvent] */
|
|
307
296
|
@ReactMethod
|
|
308
|
-
fun trackPageWithCustomData(params: ReadableMap
|
|
309
|
-
runOnPlugin(
|
|
310
|
-
|
|
311
|
-
|
|
297
|
+
override fun trackPageWithCustomData(params: ReadableMap, pageTitle: String, promise: Promise) {
|
|
298
|
+
runOnPlugin(
|
|
299
|
+
whenInitialized = {
|
|
300
|
+
instance?.trackCustomPage(pageTitle, params.toMap(keyTransform = { it.toString() }))
|
|
301
|
+
}
|
|
302
|
+
)
|
|
312
303
|
promise.resolve(true)
|
|
313
304
|
}
|
|
314
305
|
|
|
315
306
|
@ReactMethod
|
|
316
|
-
fun trackPage(pageTitle: String, promise: Promise) {
|
|
317
|
-
runOnPlugin(whenInitialized = {
|
|
318
|
-
instance.trackPage(PageViewEvent(pageTitle))
|
|
319
|
-
})
|
|
307
|
+
override fun trackPage(pageTitle: String, promise: Promise) {
|
|
308
|
+
runOnPlugin(whenInitialized = { instance?.trackPage(PageViewEvent(pageTitle)) })
|
|
320
309
|
promise.resolve(true)
|
|
321
310
|
}
|
|
322
311
|
|
|
323
312
|
@ReactMethod
|
|
324
|
-
fun sendRequestsAndClean(promise: Promise) {
|
|
325
|
-
runOnPlugin(
|
|
326
|
-
whenInitialized = {
|
|
327
|
-
instance.sendRequestsNowAndClean()
|
|
328
|
-
})
|
|
313
|
+
override fun sendRequestsAndClean(promise: Promise) {
|
|
314
|
+
runOnPlugin(whenInitialized = { instance?.sendRequestsNowAndClean() })
|
|
329
315
|
promise.resolve(true)
|
|
330
316
|
}
|
|
331
317
|
|
|
318
|
+
|
|
332
319
|
@ReactMethod
|
|
333
|
-
fun trackAction(
|
|
320
|
+
override fun trackAction(
|
|
334
321
|
name: String,
|
|
335
|
-
eventParameters: ReadableMap
|
|
336
|
-
sessionParameters: ReadableMap
|
|
337
|
-
userCategories: ReadableMap
|
|
338
|
-
eCommerceParameters: ReadableMap
|
|
339
|
-
campaignParameters: ReadableMap
|
|
322
|
+
eventParameters: ReadableMap,
|
|
323
|
+
sessionParameters: ReadableMap,
|
|
324
|
+
userCategories: ReadableMap,
|
|
325
|
+
eCommerceParameters: ReadableMap,
|
|
326
|
+
campaignParameters: ReadableMap,
|
|
340
327
|
promise: Promise
|
|
341
328
|
) {
|
|
342
329
|
runOnPlugin(
|
|
@@ -346,15 +333,36 @@ class MappinteligencePluginModule(private val reactContext: ReactApplicationCont
|
|
|
346
333
|
val userCat = UserCategoriesMapper(userCategories).getData()
|
|
347
334
|
val ecommerce = ECommerceParametersMapper(eCommerceParameters).getData()
|
|
348
335
|
val campaignParams = CampaignParametersMapper(campaignParameters).getData()
|
|
349
|
-
val actionEvent =
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
336
|
+
val actionEvent =
|
|
337
|
+
ActionEvent(name).apply {
|
|
338
|
+
this.eventParameters = event
|
|
339
|
+
this.sessionParameters = session
|
|
340
|
+
this.userCategories = userCat
|
|
341
|
+
this.eCommerceParameters = ecommerce
|
|
342
|
+
this.campaignParameters = campaignParams
|
|
343
|
+
}
|
|
344
|
+
instance?.trackAction(actionEvent)
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
promise.resolve(true)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
@ReactMethod
|
|
351
|
+
override fun trackException(
|
|
352
|
+
name: String,
|
|
353
|
+
message: String,
|
|
354
|
+
stacktrace: String?,
|
|
355
|
+
promise: Promise
|
|
356
|
+
) {
|
|
357
|
+
runOnPlugin(
|
|
358
|
+
whenInitialized = {
|
|
359
|
+
if (stacktrace.isNullOrEmpty()) {
|
|
360
|
+
instance?.trackException(name, message)
|
|
361
|
+
} else {
|
|
362
|
+
instance?.trackException(name, message + "\n${stacktrace}")
|
|
355
363
|
}
|
|
356
|
-
|
|
357
|
-
|
|
364
|
+
}
|
|
365
|
+
)
|
|
358
366
|
promise.resolve(true)
|
|
359
367
|
}
|
|
360
368
|
|
|
@@ -363,120 +371,141 @@ class MappinteligencePluginModule(private val reactContext: ReactApplicationCont
|
|
|
363
371
|
runOnPlugin(
|
|
364
372
|
whenInitialized = {
|
|
365
373
|
val innerException = Exception(exception.getString("message"))
|
|
366
|
-
instance
|
|
367
|
-
|
|
368
|
-
|
|
374
|
+
instance?.trackException(innerException)
|
|
375
|
+
}
|
|
376
|
+
)
|
|
369
377
|
promise.resolve(true)
|
|
370
378
|
}
|
|
371
379
|
|
|
372
380
|
@ReactMethod
|
|
373
|
-
fun trackMedia(readableMap: ReadableMap
|
|
374
|
-
runOnPlugin(
|
|
375
|
-
|
|
376
|
-
instance
|
|
381
|
+
override fun trackMedia(readableMap: ReadableMap, promise: Promise) {
|
|
382
|
+
runOnPlugin(
|
|
383
|
+
whenInitialized = {
|
|
384
|
+
MediaEventMapper(readableMap).getData()?.let { instance?.trackMedia(it) }
|
|
377
385
|
}
|
|
378
|
-
|
|
386
|
+
)
|
|
379
387
|
promise.resolve(true)
|
|
380
388
|
}
|
|
381
389
|
|
|
382
390
|
@ReactMethod
|
|
383
|
-
fun trackUrl(url: String, mediaCode: String?, promise: Promise) {
|
|
384
|
-
runOnPlugin(
|
|
385
|
-
whenInitialized = {
|
|
386
|
-
instance.trackUrl(Uri.parse(url), mediaCode)
|
|
387
|
-
})
|
|
391
|
+
override fun trackUrl(url: String, mediaCode: String?, promise: Promise) {
|
|
392
|
+
runOnPlugin(whenInitialized = { instance?.trackUrl(url.toUri(), mediaCode) })
|
|
388
393
|
promise.resolve(true)
|
|
389
394
|
}
|
|
390
395
|
|
|
391
396
|
@ReactMethod
|
|
392
|
-
fun trackExceptionWithName(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
override fun trackExceptionWithName(
|
|
398
|
+
name: String,
|
|
399
|
+
message: String,
|
|
400
|
+
stacktrace: String?,
|
|
401
|
+
promise: Promise
|
|
402
|
+
) {
|
|
403
|
+
runOnPlugin(
|
|
404
|
+
whenInitialized = {
|
|
405
|
+
Log.d("MappIntelligencePlugin", "trackExceptionWithName")
|
|
406
|
+
if (stacktrace.isNullOrEmpty()) {
|
|
407
|
+
instance?.trackException(name, message)
|
|
408
|
+
} else {
|
|
409
|
+
instance?.trackException(name, message + "\n${stacktrace}")
|
|
410
|
+
}
|
|
399
411
|
}
|
|
400
|
-
|
|
412
|
+
)
|
|
401
413
|
promise.resolve(true)
|
|
402
414
|
}
|
|
403
415
|
|
|
404
|
-
/**
|
|
405
|
-
* Configure webtrekk SDK and initialize it
|
|
406
|
-
*/
|
|
416
|
+
/** Configure webtrekk SDK and initialize it */
|
|
407
417
|
@ReactMethod
|
|
408
|
-
fun build(promise: Promise) {
|
|
409
|
-
runOnPlugin(
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
418
|
+
override fun build(promise: Promise) {
|
|
419
|
+
runOnPlugin(
|
|
420
|
+
whenNotInitialized = {
|
|
421
|
+
val builder =
|
|
422
|
+
WebtrekkConfiguration.Builder(
|
|
423
|
+
configAdapter.trackIds,
|
|
424
|
+
configAdapter.trackDomain
|
|
425
|
+
)
|
|
426
|
+
.logLevel(configAdapter.logLevel)
|
|
427
|
+
.enableCrashTracking(configAdapter.exceptionLogLevel)
|
|
428
|
+
.setBatchSupport(
|
|
429
|
+
configAdapter.batchSupport,
|
|
430
|
+
configAdapter.requestPerBatch
|
|
431
|
+
)
|
|
432
|
+
.requestsInterval(
|
|
433
|
+
TimeUnit.MINUTES,
|
|
434
|
+
configAdapter.requestsIntervalMinutes.toLong()
|
|
435
|
+
)
|
|
436
|
+
.setEverId(configAdapter.everId)
|
|
437
|
+
.sendAppVersionInEveryRequest(configAdapter.versionInEachRequest)
|
|
438
|
+
|
|
439
|
+
if (configAdapter.shouldMigrate) builder.enableMigration()
|
|
440
|
+
|
|
441
|
+
if (!configAdapter.autoTracking) builder.disableAutoTracking()
|
|
442
|
+
|
|
443
|
+
if (!configAdapter.activityAutoTracking) builder.disableActivityAutoTracking()
|
|
444
|
+
|
|
445
|
+
if (!configAdapter.fragmentsAutoTracking) builder.disableFragmentsAutoTracking()
|
|
446
|
+
|
|
447
|
+
instance =
|
|
448
|
+
Webtrekk.getInstance().apply {
|
|
449
|
+
this.init(reactContext.applicationContext, builder.build())
|
|
450
|
+
this.anonymousTracking(configAdapter.anonymousTracking)
|
|
451
|
+
this.setTemporarySessionId(configAdapter.temporarySessionId)
|
|
452
|
+
}
|
|
453
|
+
promise.resolve(true)
|
|
454
|
+
println("MappIntelligence initialized!")
|
|
455
|
+
},
|
|
456
|
+
whenInitialized = {
|
|
457
|
+
promise.resolve(true)
|
|
458
|
+
println("MappIntelligence was already initialized!")
|
|
431
459
|
}
|
|
432
|
-
|
|
433
|
-
promise.resolve(true)
|
|
460
|
+
)
|
|
434
461
|
}
|
|
435
462
|
|
|
436
463
|
/**
|
|
437
|
-
* Helper function to execute actions based on Webtrekk instance state
|
|
438
|
-
*
|
|
464
|
+
* Helper function to execute actions based on Webtrekk instance state Provide two functions as
|
|
465
|
+
* input parameters to be executed if instance is initialized or not
|
|
439
466
|
*/
|
|
440
467
|
private fun runOnPlugin(whenInitialized: () -> Unit, whenNotInitialized: (() -> Unit)? = null) {
|
|
441
|
-
if (
|
|
442
|
-
|
|
468
|
+
if (instance != null) {
|
|
469
|
+
whenInitialized.invoke()
|
|
470
|
+
} else {
|
|
471
|
+
whenNotInitialized?.invoke()
|
|
472
|
+
}
|
|
443
473
|
}
|
|
444
474
|
|
|
445
475
|
@ReactMethod
|
|
446
|
-
|
|
447
|
-
runOnPlugin(whenInitialized = {
|
|
448
|
-
reset { }
|
|
449
|
-
})
|
|
476
|
+
override fun reset(promise: Promise) {
|
|
477
|
+
runOnPlugin(whenInitialized = { reset {} })
|
|
450
478
|
promise.resolve(true)
|
|
451
479
|
}
|
|
452
480
|
|
|
453
481
|
/**
|
|
454
482
|
* Reset underlying SDK and set new values via
|
|
455
|
-
* @param presetAction
|
|
456
|
-
* to change existing configuration and
|
|
483
|
+
* @param presetAction
|
|
484
|
+
* - action that has access to WebtrekkConfiguration Builder to change existing configuration and
|
|
485
|
+
* set new values
|
|
457
486
|
*/
|
|
458
487
|
private fun reset(presetAction: (WebtrekkConfiguration.Builder) -> Unit) {
|
|
459
488
|
Webtrekk.reset(reactContext.applicationContext)
|
|
460
489
|
val trackIds = configAdapter.trackIds
|
|
461
490
|
val domain = configAdapter.trackDomain
|
|
462
491
|
|
|
463
|
-
instance
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
492
|
+
instance?.setIdsAndDomain(trackIds, domain)
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
@ReactMethod
|
|
496
|
+
override fun getCurrentConfig(promise: Promise) {
|
|
497
|
+
runOnPlugin(
|
|
498
|
+
whenInitialized = {
|
|
499
|
+
val config = instance?.getCurrentConfiguration()
|
|
500
|
+
promise.resolve(config?.toString() ?: "")
|
|
501
|
+
},
|
|
502
|
+
whenNotInitialized = { promise.resolve("") }
|
|
503
|
+
)
|
|
470
504
|
}
|
|
471
505
|
|
|
472
506
|
@ReactMethod
|
|
473
|
-
fun
|
|
474
|
-
|
|
475
|
-
val config = Webtrekk.getInstance().getCurrentConfiguration()
|
|
476
|
-
promise.resolve(config.toString())
|
|
477
|
-
}, whenNotInitialized = {
|
|
478
|
-
promise.resolve("")
|
|
479
|
-
})
|
|
507
|
+
override fun nativeCrash(promise: Promise) {
|
|
508
|
+
throw Exception("Native crash")
|
|
480
509
|
}
|
|
481
510
|
|
|
482
511
|
@ReactMethod
|
|
@@ -488,7 +517,7 @@ class MappinteligencePluginModule(private val reactContext: ReactApplicationCont
|
|
|
488
517
|
return NAME
|
|
489
518
|
}
|
|
490
519
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
}
|
|
520
|
+
override fun initialize() {}
|
|
521
|
+
|
|
522
|
+
override fun invalidate() {}
|
|
494
523
|
}
|