react-native-moengage 7.4.0 → 7.4.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 +5 -3
- package/README.md +29 -6
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/moengage/react/MoEReactBridge.kt +10 -0
- package/android/src/main/java/com/moengage/react/MoEReactPackage.kt +0 -1
- package/package.json +1 -1
- package/src/index.ts +50 -2
- package/src/platform/MoERNAndroid.ts +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
## Changelog:
|
|
2
|
+
|
|
3
|
+
### 7.4.1
|
|
4
|
+
- Device identifier tracking update as per Google's User data policy. Advertising Id is only tracked after user consent.
|
|
5
|
+
|
|
4
6
|
### 7.4.0
|
|
5
7
|
Release Date: 12th May 2022
|
|
6
8
|
- Bugfix iOS: Fixed the PushClick callback issue in terminated state, that was appearing when the react-native version is above 0.65.
|
package/README.md
CHANGED
|
@@ -10,23 +10,46 @@ $ react-native link
|
|
|
10
10
|
After installing the plugin lets move on to platform specific configuration.
|
|
11
11
|
|
|
12
12
|
### Android
|
|
13
|
-
|
|
13
|
+
Add `mavenCentral()` repository in the project-level `build.gradle` file.
|
|
14
|
+
|
|
15
|
+
```groovy
|
|
16
|
+
buildscript {
|
|
17
|
+
repositories
|
|
18
|
+
{
|
|
19
|
+
mavenCentral()
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
allprojects {
|
|
24
|
+
repositories {
|
|
25
|
+
mavenCentral()
|
|
26
|
+
}
|
|
27
|
+
}
|
|
14
28
|
```
|
|
29
|
+
|
|
30
|
+
In android/settings.gradle add the following
|
|
31
|
+
|
|
32
|
+
```groovy
|
|
15
33
|
include ':react-native-moengage'
|
|
16
34
|
project(':react-native-moengage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-moengage/android')
|
|
17
35
|
```
|
|
18
36
|
|
|
19
37
|
In android/app/build.gradle add the following
|
|
20
|
-
|
|
38
|
+
|
|
39
|
+
```groovy
|
|
21
40
|
dependencies {
|
|
22
41
|
...
|
|
23
42
|
|
|
24
|
-
|
|
43
|
+
implementation project(':react-native-moengage')
|
|
44
|
+
implementation("com.moengage:moe-android-sdk:11.6.02")
|
|
45
|
+
implementation("androidx.core:core:1.3.1")
|
|
46
|
+
implementation("androidx.appcompat:appcompat:1.2.0")
|
|
47
|
+
implementation("androidx.lifecycle:lifecycle-process:2.2.0")
|
|
25
48
|
}
|
|
26
49
|
```
|
|
27
50
|
Add the MoEngage React Package in the Application class's getPackages() Also enable auto integration in the onCreate()
|
|
28
51
|
|
|
29
|
-
```
|
|
52
|
+
```java
|
|
30
53
|
public class MainApplication extends Application implements ReactApplication {
|
|
31
54
|
|
|
32
55
|
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
|
|
@@ -55,7 +78,7 @@ Add the MoEngage React Package in the Application class's getPackages() Also ena
|
|
|
55
78
|
```
|
|
56
79
|
In case you are facing issues with the import add the below import statement in your java file.
|
|
57
80
|
|
|
58
|
-
```
|
|
81
|
+
```java
|
|
59
82
|
import com.moengage.react.MoEReactPackage;
|
|
60
83
|
```
|
|
61
84
|
|
|
@@ -69,4 +92,4 @@ Incase if you get errors in the test targets of the project, go to build setting
|
|
|
69
92
|
|
|
70
93
|
Thats it!! SDK is successfully installed in the project, and ready to use.
|
|
71
94
|
|
|
72
|
-
For more info on how to use react-native-moengage, refer to our developer docs: https://
|
|
95
|
+
For more info on how to use react-native-moengage, refer to our developer docs: https://developers.moengage.com/hc/en-us/categories/4404199274900-React-Native-SDK
|
package/android/build.gradle
CHANGED
|
@@ -206,6 +206,16 @@ class MoEReactBridge(reactContext: ReactApplicationContext) :
|
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
+
@ReactMethod
|
|
210
|
+
fun deviceIdentifierTrackingStatusUpdate(payload: String) {
|
|
211
|
+
try {
|
|
212
|
+
Logger.v("$tag deviceIdentifierTrackingStatusUpdate(): $payload")
|
|
213
|
+
pluginHelper.deviceIdentifierTrackingStatusUpdate(context, payload)
|
|
214
|
+
} catch (e: Exception) {
|
|
215
|
+
Logger.e("$tag deviceIdentifierTrackingStatusUpdate() : ", e)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
209
219
|
|
|
210
220
|
init {
|
|
211
221
|
pluginHelper.setEventCallback(EventEmitterImpl(reactContext))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-moengage",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.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
6
|
"keywords": [
|
package/src/index.ts
CHANGED
|
@@ -711,11 +711,59 @@ var ReactMoE = {
|
|
|
711
711
|
},
|
|
712
712
|
|
|
713
713
|
onOrientationChanged: function() {
|
|
714
|
-
console.log("Will process screen rotation.")
|
|
714
|
+
console.log("Will process screen rotation.");
|
|
715
715
|
if(Platform.OS == PLATFORM_ANDROID) {
|
|
716
|
-
MoERNAndroid.onOrientationChanged()
|
|
716
|
+
MoERNAndroid.onOrientationChanged();
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* API to enable Advertising Id tracking for Android.
|
|
722
|
+
*/
|
|
723
|
+
enableAdIdTracking: function() {
|
|
724
|
+
console.log("Will enable advertising-id tracking");
|
|
725
|
+
if(Platform.OS == PLATFORM_ANDROID) {
|
|
726
|
+
MoERNAndroid.enableAdIdTracking();
|
|
727
|
+
}
|
|
728
|
+
},
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* API to disable Advertising Id tracking for Android.
|
|
732
|
+
*
|
|
733
|
+
* By default Advertising Id tracking is disabled, call this method only if you have enabled
|
|
734
|
+
* Advertising Id tracking at some point.
|
|
735
|
+
*/
|
|
736
|
+
disableAdIdTracking: function() {
|
|
737
|
+
console.log("Will disable advertising-id tracking");
|
|
738
|
+
if(Platform.OS == PLATFORM_ANDROID) {
|
|
739
|
+
MoERNAndroid.disableAdIdTracking();
|
|
740
|
+
}
|
|
741
|
+
},
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* API to enable Android Id tracking for Android.
|
|
745
|
+
*/
|
|
746
|
+
enableAndroidIdTracking: function() {
|
|
747
|
+
console.log("Will enable android-id tracking");
|
|
748
|
+
if(Platform.OS == PLATFORM_ANDROID) {
|
|
749
|
+
MoERNAndroid.enableAndroidIdTracking();
|
|
750
|
+
}
|
|
751
|
+
},
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* API to disable Android Id tracking for Android.
|
|
755
|
+
*
|
|
756
|
+
* By default Android Id tracking is disabled, call this method only if you have enabled
|
|
757
|
+
* Advertising Id tracking at some point.
|
|
758
|
+
*/
|
|
759
|
+
disableAndroidIdTracking: function() {
|
|
760
|
+
console.log("Will disable android-id tracking");
|
|
761
|
+
if(Platform.OS == PLATFORM_ANDROID) {
|
|
762
|
+
MoERNAndroid.disableAndroidIdTracking();
|
|
717
763
|
}
|
|
718
764
|
}
|
|
765
|
+
|
|
766
|
+
|
|
719
767
|
};
|
|
720
768
|
|
|
721
769
|
export {
|
|
@@ -145,6 +145,34 @@ export class MoERNAndroid {
|
|
|
145
145
|
static onOrientationChanged() {
|
|
146
146
|
MoEReactBridge.onOrientationChanged()
|
|
147
147
|
}
|
|
148
|
+
|
|
149
|
+
static enableAdIdTracking() {
|
|
150
|
+
let payload = {
|
|
151
|
+
"isAdIdTrackingEnabled": true
|
|
152
|
+
}
|
|
153
|
+
MoEReactBridge.deviceIdentifierTrackingStatusUpdate(JSON.stringify(payload))
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
static disableAdIdTracking() {
|
|
157
|
+
let payload = {
|
|
158
|
+
"isAdIdTrackingEnabled": false
|
|
159
|
+
}
|
|
160
|
+
MoEReactBridge.deviceIdentifierTrackingStatusUpdate(JSON.stringify(payload))
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
static enableAndroidIdTracking() {
|
|
164
|
+
let payload = {
|
|
165
|
+
"isAndroidIdTrackingEnabled": true
|
|
166
|
+
}
|
|
167
|
+
MoEReactBridge.deviceIdentifierTrackingStatusUpdate(JSON.stringify(payload))
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static disableAndroidIdTracking() {
|
|
171
|
+
let payload = {
|
|
172
|
+
"isAndroidIdTrackingEnabled": false
|
|
173
|
+
}
|
|
174
|
+
MoEReactBridge.deviceIdentifierTrackingStatusUpdate(JSON.stringify(payload))
|
|
175
|
+
}
|
|
148
176
|
}
|
|
149
177
|
|
|
150
178
|
const PUSH_SERVICE_FCM = "FCM"
|