react-native-moengage 8.4.0 → 8.5.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/CHANGELOG.md +17 -0
- package/ReactNativeMoEngage.podspec +3 -3
- package/android/build.gradle +5 -5
- package/android/src/main/java/com/moengage/react/EventEmitterImpl.kt +8 -19
- package/android/src/main/java/com/moengage/react/GlobalCache.kt +1 -19
- package/android/src/main/java/com/moengage/react/MoEInitializer.kt +4 -4
- package/android/src/main/java/com/moengage/react/MoEReactBridge.kt +12 -6
- package/iOS/MoEReactBridge/MoEngageInitializer.m +5 -6
- package/iOS/MoEReactBridge/MoEngageReactConstants.h +1 -0
- package/iOS/MoEReactBridge/MoEngageReactConstants.m +1 -0
- package/package.json +13 -2
- package/src/index.ts +102 -95
- package/src/logger/MoEngageLogger.ts +77 -0
- package/src/models/MoEInitConfig.ts +36 -0
- package/src/models/MoEProperties.ts +8 -7
- package/src/models/MoEPushCampaign.ts +3 -1
- package/src/models/MoEPushConfig.ts +25 -0
- package/src/models/MoEngageLogConfig.ts +69 -0
- package/src/moeParser/MoEInAppParser.ts +28 -7
- package/src/moeParser/MoEPushNotificationParser.ts +8 -4
- package/src/moeParser/MoEngagePayloadParser.ts +0 -1
- package/src/platform/MoERNAndroid.ts +5 -17
- package/src/platform/MoERNiOS.ts +2 -2
- package/src/utils/MoEConstants.ts +16 -0
- package/src/utils/MoEJsonBuilder.ts +17 -1
- package/src/utils/MoEngageGlobalCache.ts +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
# 18-07-2023
|
|
2
|
+
|
|
3
|
+
## 8.5.1
|
|
4
|
+
- Adding Strict TypeCheck For TypeScript files
|
|
5
|
+
- Support for configuring the React-Native Plugin console logs
|
|
6
|
+
|
|
7
|
+
# 25-05-2023
|
|
8
|
+
|
|
9
|
+
## 8.5.0
|
|
10
|
+
- Android
|
|
11
|
+
- Support for handling Foreground Push Notification Click
|
|
12
|
+
- Target & Compile SDK version updated to 33
|
|
13
|
+
- BugFix
|
|
14
|
+
- Self handled InApps Callback fix in Event Triggered Campaign
|
|
15
|
+
- iOS
|
|
16
|
+
- MoEngage-iOS-SDK version updated to `~>9.8.0`.
|
|
17
|
+
|
|
1
18
|
# 16-02-2023
|
|
2
19
|
|
|
3
20
|
## 8.4.0
|
|
@@ -12,11 +12,11 @@ Pod::Spec.new do |s|
|
|
|
12
12
|
s.license = package['license']
|
|
13
13
|
s.authors = "MoEngage Inc."
|
|
14
14
|
s.source = {:file => './' }
|
|
15
|
-
s.platform = :ios, "
|
|
15
|
+
s.platform = :ios, "11.0"
|
|
16
16
|
s.source_files = 'iOS/MoEReactBridge/**/*.{h,m}'
|
|
17
17
|
s.dependency 'React'
|
|
18
|
-
s.dependency 'MoEngagePluginBase','>= 4.
|
|
19
|
-
s.dependency 'MoEngageRichNotification','>= 7.
|
|
18
|
+
s.dependency 'MoEngagePluginBase','>= 4.2.0','< 4.3.0'
|
|
19
|
+
s.dependency 'MoEngageRichNotification','>= 7.8.0','< 7.9.0'
|
|
20
20
|
|
|
21
21
|
s.prepare_command = <<-CMD
|
|
22
22
|
echo // Generated file, do not edit > iOS/MoEReactBridge/MoEngageReactPluginInfo.h
|
package/android/build.gradle
CHANGED
|
@@ -20,13 +20,13 @@ rootProject.allprojects {
|
|
|
20
20
|
|
|
21
21
|
ext {
|
|
22
22
|
//dependency version
|
|
23
|
-
moengageCoreVersion = "12.
|
|
24
|
-
moengageInAppVersion = "6.
|
|
25
|
-
basePluginVersion = "3.
|
|
23
|
+
moengageCoreVersion = "12.8.00"
|
|
24
|
+
moengageInAppVersion = "6.7.0"
|
|
25
|
+
basePluginVersion = "3.3.1"
|
|
26
26
|
//build versions
|
|
27
27
|
minimumVersion = 21
|
|
28
|
-
targetVersion =
|
|
29
|
-
compileVersion =
|
|
28
|
+
targetVersion = 33
|
|
29
|
+
compileVersion = 33
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
apply plugin: 'com.android.library'
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
package com.moengage.react
|
|
2
2
|
|
|
3
|
+
import android.os.Bundle
|
|
3
4
|
import com.facebook.react.bridge.ReactContext
|
|
4
5
|
import com.facebook.react.bridge.WritableMap
|
|
5
6
|
import com.facebook.react.common.LifecycleState
|
|
6
7
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
8
|
+
import com.moe.pushlibrary.activities.MoEActivity
|
|
7
9
|
import com.moengage.core.LogLevel
|
|
10
|
+
import com.moengage.core.PUSH_NOTIFICATION_NAVIGATION_ACTIVITY_NAME
|
|
11
|
+
import com.moengage.core.PUSH_NOTIFICATION_NAVIGATION_DEEPLINK_LEGACY
|
|
8
12
|
import com.moengage.core.internal.logger.Logger
|
|
9
13
|
import com.moengage.plugin.base.internal.EventEmitter
|
|
10
|
-
import com.moengage.plugin.base.internal.instanceMetaFromJson
|
|
11
14
|
import com.moengage.plugin.base.internal.model.events.Event
|
|
12
15
|
import com.moengage.plugin.base.internal.model.events.EventType
|
|
13
16
|
import com.moengage.plugin.base.internal.model.events.inapp.InAppActionEvent
|
|
@@ -16,7 +19,10 @@ import com.moengage.plugin.base.internal.model.events.inapp.InAppSelfHandledEven
|
|
|
16
19
|
import com.moengage.plugin.base.internal.model.events.push.PermissionEvent
|
|
17
20
|
import com.moengage.plugin.base.internal.model.events.push.PushClickedEvent
|
|
18
21
|
import com.moengage.plugin.base.internal.model.events.push.TokenEvent
|
|
19
|
-
import
|
|
22
|
+
import com.moengage.pushbase.NAVIGATION_TYPE_RICH_LANDING
|
|
23
|
+
import com.moengage.pushbase.NAVIGATION_TYPE_SCREEN_NAME
|
|
24
|
+
import com.moengage.pushbase.NAV_ACTION
|
|
25
|
+
import com.moengage.pushbase.model.action.NavigationAction
|
|
20
26
|
|
|
21
27
|
|
|
22
28
|
/**
|
|
@@ -69,13 +75,6 @@ class EventEmitterImpl(private val reactContext: ReactContext) : EventEmitter {
|
|
|
69
75
|
Logger.print { "$tag emitPushClicked() : $event" }
|
|
70
76
|
val eventName = eventMapping[event.eventType] ?: return
|
|
71
77
|
val payload = PayloadGenerator().pushPayloadToWriteableMap(event.payload)
|
|
72
|
-
if (GlobalCache.lifecycleAwarePushCallbackEnabled
|
|
73
|
-
&& reactContext.lifecycleState != LifecycleState.RESUMED
|
|
74
|
-
) {
|
|
75
|
-
Logger.print { "$tag emitPushClicked() : ${reactContext.lifecycleState}" }
|
|
76
|
-
GlobalCache.addPushClickedEventToCache(payload)
|
|
77
|
-
return
|
|
78
|
-
}
|
|
79
78
|
emit(eventName, payload)
|
|
80
79
|
}
|
|
81
80
|
|
|
@@ -101,16 +100,6 @@ class EventEmitterImpl(private val reactContext: ReactContext) : EventEmitter {
|
|
|
101
100
|
val payload = PayloadGenerator().permissionResultToWriteableMap(event.result)
|
|
102
101
|
emit(eventName, payload)
|
|
103
102
|
}
|
|
104
|
-
|
|
105
|
-
internal fun emitPendingEvents() {
|
|
106
|
-
if (GlobalCache.lifecycleAwarePushCallbackEnabled) {
|
|
107
|
-
val cachedPushClickedEvent = GlobalCache.getPushClickedCachedEvent() ?: return
|
|
108
|
-
val eventName = eventMapping[EventType.PUSH_CLICKED] ?: return
|
|
109
|
-
GlobalCache.removePushClickedEventFromCache()
|
|
110
|
-
|
|
111
|
-
emit(eventName, cachedPushClickedEvent)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
103
|
}
|
|
115
104
|
|
|
116
105
|
val eventMapping = mapOf<EventType, String>(
|
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
package com.moengage.react
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.bridge.WritableMap
|
|
4
|
-
|
|
5
3
|
object GlobalCache {
|
|
6
4
|
|
|
7
|
-
var
|
|
5
|
+
var lifecycleAwareCallbackEnabled = false
|
|
8
6
|
internal set
|
|
9
|
-
|
|
10
|
-
private var pushClickedCachedEvent: WritableMap? = null
|
|
11
|
-
|
|
12
|
-
fun getPushClickedCachedEvent(): WritableMap? {
|
|
13
|
-
return pushClickedCachedEvent
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
internal fun addPushClickedEventToCache(
|
|
17
|
-
pushClickedEvent: WritableMap
|
|
18
|
-
) {
|
|
19
|
-
this.pushClickedCachedEvent = pushClickedEvent
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
internal fun removePushClickedEventFromCache() {
|
|
23
|
-
pushClickedCachedEvent = null
|
|
24
|
-
}
|
|
25
7
|
}
|
|
@@ -44,11 +44,11 @@ object MoEInitializer {
|
|
|
44
44
|
fun initializeDefaultInstance(
|
|
45
45
|
context: Context,
|
|
46
46
|
builder: MoEngage.Builder,
|
|
47
|
-
|
|
47
|
+
lifecycleAwareCallbackEnabled: Boolean = false
|
|
48
48
|
) {
|
|
49
49
|
try {
|
|
50
50
|
Logger.print { "$tag initialize() : Will try to initialize the sdk." }
|
|
51
|
-
GlobalCache.
|
|
51
|
+
GlobalCache.lifecycleAwareCallbackEnabled = lifecycleAwareCallbackEnabled
|
|
52
52
|
PluginInitializer.initialize(
|
|
53
53
|
builder,
|
|
54
54
|
IntegrationMeta(INTEGRATION_TYPE, BuildConfig.MOENGAGE_REACT_LIBRARY_VERSION)
|
|
@@ -63,11 +63,11 @@ object MoEInitializer {
|
|
|
63
63
|
context: Context,
|
|
64
64
|
builder: MoEngage.Builder,
|
|
65
65
|
sdkState: SdkState,
|
|
66
|
-
|
|
66
|
+
lifecycleAwareCallbackEnabled: Boolean = false
|
|
67
67
|
) {
|
|
68
68
|
try {
|
|
69
69
|
Logger.print { "$tag initialize() : Initialising MoEngage SDK." }
|
|
70
|
-
GlobalCache.
|
|
70
|
+
GlobalCache.lifecycleAwareCallbackEnabled = lifecycleAwareCallbackEnabled
|
|
71
71
|
PluginInitializer.initialize(
|
|
72
72
|
builder,
|
|
73
73
|
IntegrationMeta(INTEGRATION_TYPE, BuildConfig.MOENGAGE_REACT_LIBRARY_VERSION),
|
|
@@ -6,8 +6,10 @@ import com.facebook.react.bridge.ReactApplicationContext
|
|
|
6
6
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
7
7
|
import com.facebook.react.bridge.ReactMethod
|
|
8
8
|
import com.moengage.core.LogLevel
|
|
9
|
+
import com.moengage.core.MoECoreHelper
|
|
9
10
|
import com.moengage.core.internal.logger.Logger
|
|
10
11
|
import com.moengage.core.internal.utils.getSdkVersion
|
|
12
|
+
import com.moengage.core.listeners.AppBackgroundListener
|
|
11
13
|
import com.moengage.plugin.base.internal.PluginHelper
|
|
12
14
|
import com.moengage.plugin.base.internal.setEventEmitter
|
|
13
15
|
|
|
@@ -23,17 +25,20 @@ class MoEReactBridge(private val reactContext: ReactApplicationContext) :
|
|
|
23
25
|
private val pluginHelper = PluginHelper()
|
|
24
26
|
private val moeSdkVersion = getSdkVersion()
|
|
25
27
|
|
|
28
|
+
private val backgroundStateListener =
|
|
29
|
+
AppBackgroundListener { _, _ -> pluginHelper.onFrameworkDetached() }
|
|
30
|
+
|
|
26
31
|
override fun getName(): String {
|
|
27
32
|
return "MoEReactBridge"
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
@ReactMethod
|
|
31
|
-
fun addListener(eventName:String) {
|
|
36
|
+
fun addListener(eventName: String) {
|
|
32
37
|
// Keep: Required for RN built in Event Emitter Calls.
|
|
33
|
-
|
|
38
|
+
}
|
|
34
39
|
|
|
35
40
|
@ReactMethod
|
|
36
|
-
fun removeListeners(count:Int) {
|
|
41
|
+
fun removeListeners(count: Int) {
|
|
37
42
|
// Keep: Required for RN built in Event Emitter Calls.
|
|
38
43
|
}
|
|
39
44
|
|
|
@@ -152,9 +157,10 @@ class MoEReactBridge(private val reactContext: ReactApplicationContext) :
|
|
|
152
157
|
try {
|
|
153
158
|
Logger.print { "$tag initialize() : " }
|
|
154
159
|
pluginHelper.initialise(payload)
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
160
|
+
setEventEmitter(EventEmitterImpl(reactContext))
|
|
161
|
+
if (GlobalCache.lifecycleAwareCallbackEnabled) {
|
|
162
|
+
MoECoreHelper.addAppBackgroundListener(backgroundStateListener)
|
|
163
|
+
}
|
|
158
164
|
} catch (t: Throwable) {
|
|
159
165
|
Logger.print(LogLevel.ERROR, t) { "$tag initialize() : " }
|
|
160
166
|
}
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
- (void)initializeDefaultSDKConfig:(MoEngageSDKConfig*)sdkConfig andLaunchOptions:(NSDictionary*)launchOptions{
|
|
39
39
|
MoEngagePlugin *plugin = [[MoEngagePlugin alloc] init];
|
|
40
40
|
[plugin initializeDefaultInstanceWithSdkConfig:sdkConfig launchOptions:launchOptions];
|
|
41
|
-
[self commonSetUp:plugin identifier:sdkConfig.
|
|
41
|
+
[self commonSetUp:plugin identifier:sdkConfig.appId];
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
- (void)initializeDefaultInstance:(BOOL)isSdkEnabled andLaunchOptions:(NSDictionary*)launchOptions{
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
MoEngagePlugin *plugin = [[MoEngagePlugin alloc] init];
|
|
63
63
|
[plugin initializeDefaultInstanceWithSdkConfig:sdkConfig sdkState:sdkState launchOptions:launchOptions];
|
|
64
|
-
[self commonSetUp: plugin identifier:sdkConfig.
|
|
64
|
+
[self commonSetUp: plugin identifier:sdkConfig.appId];
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
#pragma mark- Utils
|
|
@@ -108,10 +108,6 @@
|
|
|
108
108
|
sdkConfig.analyticsPeriodicFlushDuration = [MoEngageReactUtils getIntegerForKey:kPeriodicFlushDuration dict:moeDict];
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
if ([moeDict objectForKey:kEncryptNetworkRequests] != nil && [moeDict objectForKey:kEncryptNetworkRequests] != [NSNull null]) {
|
|
112
|
-
sdkConfig.encryptNetworkRequests = [MoEngageReactUtils getBooleanForKey:kEncryptNetworkRequests dict:moeDict];
|
|
113
|
-
}
|
|
114
|
-
|
|
115
111
|
if ([moeDict objectForKey:kEnableLogs] != nil && [moeDict objectForKey:kEnableLogs] != [NSNull null]) {
|
|
116
112
|
sdkConfig.enableLogs = [MoEngageReactUtils getBooleanForKey:kEnableLogs dict:moeDict];
|
|
117
113
|
}
|
|
@@ -137,6 +133,9 @@
|
|
|
137
133
|
} else if ([stringVal isEqual: kDataCenter4])
|
|
138
134
|
{
|
|
139
135
|
dataCenter = MoEngageDataCenterData_center_04;
|
|
136
|
+
} else if ([stringVal isEqual: kDataCenter5])
|
|
137
|
+
{
|
|
138
|
+
dataCenter = MoEngageDataCenterData_center_05;
|
|
140
139
|
}
|
|
141
140
|
else
|
|
142
141
|
{
|
|
@@ -25,6 +25,7 @@ NSString* const kDataCenter1 = @"DATA_CENTER_01";
|
|
|
25
25
|
NSString* const kDataCenter2 = @"DATA_CENTER_02";
|
|
26
26
|
NSString* const kDataCenter3 = @"DATA_CENTER_03";
|
|
27
27
|
NSString* const kDataCenter4 = @"DATA_CENTER_04";
|
|
28
|
+
NSString* const kDataCenter5 = @"DATA_CENTER_05";
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
//PayLoad Constants
|
package/package.json
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-moengage",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.5.1",
|
|
4
4
|
"description": "MoEngage is a mobile marketing automation company. This react-native SDK helps you track events, trigger smart notifications and in-apps, provides a drop-in Inbox Controller for notifications.",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"android",
|
|
8
|
+
"iOS",
|
|
9
|
+
"src",
|
|
10
|
+
"CHANGELOG.md",
|
|
11
|
+
"README.md",
|
|
12
|
+
"ReactNativeMoEngage.podspec",
|
|
13
|
+
"package.json",
|
|
14
|
+
"!**/__tests__",
|
|
15
|
+
"!**/__mocks__"
|
|
16
|
+
],
|
|
6
17
|
"keywords": [
|
|
7
18
|
"moengage",
|
|
8
19
|
"push-notification",
|
|
@@ -23,4 +34,4 @@
|
|
|
23
34
|
"devDependencies": {
|
|
24
35
|
"@types/react-native": "^0.69.3"
|
|
25
36
|
}
|
|
26
|
-
}
|
|
37
|
+
}
|