react-native-mapp-plugin 1.4.0 → 1.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 CHANGED
@@ -1,3 +1,14 @@
1
+ ## Version 1.4.1
2
+
3
+ ***Dependency Updates***
4
+
5
+ - Android: Aligned with Mapp Engage Android SDK 7.1.1.
6
+ - iOS: Aligned with Mapp Engage Inapp iOS SDK 6.0.11, which provides improved in-app statistics.
7
+
8
+ ***Architecture***
9
+
10
+ - Android: Updated plugin to support New Architecture (TurboModule).
11
+
1
12
  ## Version 1.4.0
2
13
 
3
14
  ***Bug Fixes***
package/Mapp.js CHANGED
@@ -6,8 +6,10 @@ import { NativeModules, Platform } from "react-native";
6
6
  import CustomEvent from "./CustomEvent.js";
7
7
 
8
8
  import MappEventEmitter from "./MappEventEmitter.js";
9
+ import NativeRNMappPluginModule from "./specs/NativeRNMappPluginModule";
9
10
 
10
- const { RNMappPluginModule } = NativeModules;
11
+ const RNMappPluginModule =
12
+ NativeRNMappPluginModule || NativeModules.RNMappPluginModule;
11
13
  const EventEmitter = new MappEventEmitter();
12
14
 
13
15
  const IOS_INIT = "com.mapp.init";
@@ -7,7 +7,10 @@ import {
7
7
  Platform
8
8
  } from 'react-native';
9
9
 
10
- const RNMappPluginModule = NativeModules.RNMappPluginModule;
10
+ import NativeRNMappPluginModule from './specs/NativeRNMappPluginModule';
11
+
12
+ const RNMappPluginModule =
13
+ NativeRNMappPluginModule || NativeModules.RNMappPluginModule;
11
14
 
12
15
  class MappEventEmitter extends NativeEventEmitter {
13
16
 
@@ -1,15 +1,16 @@
1
- plugins {
2
- id("com.android.library")
3
- id("com.facebook.react") // This is required for New Architecture & Codegen
1
+ apply plugin: "com.android.library"
2
+
3
+ def getExtOrDefault = { name, fallback ->
4
+ rootProject.ext.has(name) ? rootProject.ext.get(name) : fallback
4
5
  }
5
6
 
6
7
  android {
7
8
  namespace "com.reactlibrary"
8
- compileSdk = 36
9
+ compileSdk = getExtOrDefault("compileSdkVersion", 36)
9
10
 
10
11
  defaultConfig {
11
- minSdk = 24
12
- targetSdk = 36
12
+ minSdk = getExtOrDefault("minSdkVersion", 24)
13
+ targetSdk = getExtOrDefault("targetSdkVersion", 36)
13
14
  versionCode = 1
14
15
  versionName = "1.0"
15
16
  }
@@ -28,25 +29,34 @@ android {
28
29
  }
29
30
 
30
31
  dependencies {
31
- implementation "com.facebook.react:react-android:0.84.1"
32
- implementation 'com.google.code.gson:gson:2.13.2'
32
+ //noinspection GradleDynamicVersion
33
+ implementation "com.facebook.react:react-native:+"
34
+ constraints {
35
+ implementation("androidx.core:core") {
36
+ version {
37
+ strictly "1.18.0"
38
+ }
39
+ because "androidx.core 1.19.0 requires AGP 9.1+, while React Native dependencies currently require the app to stay on AGP 8"
40
+ }
41
+ implementation("androidx.core:core-ktx") {
42
+ version {
43
+ strictly "1.18.0"
44
+ }
45
+ because "androidx.core-ktx 1.19.0 requires AGP 9.1+, while React Native dependencies currently require the app to stay on AGP 8"
46
+ }
47
+ }
48
+ implementation 'com.google.code.gson:gson:2.14.0'
33
49
  implementation 'androidx.appcompat:appcompat:1.7.1'
34
- implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.10.0'
35
- implementation platform('com.google.firebase:firebase-bom:34.11.0')
50
+ implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7'
51
+ implementation platform('com.google.firebase:firebase-bom:33.16.0')
36
52
  implementation('com.google.firebase:firebase-messaging')
37
53
  api('com.google.android.gms:play-services-location:21.3.0')
38
- implementation 'androidx.media:media:1.7.1'
54
+ implementation 'androidx.media:media:1.8.0'
39
55
  implementation 'androidx.legacy:legacy-support-v13:1.0.0'
40
- implementation("com.mapp.sdk:engage-android:7.0.2")
56
+ implementation("com.mapp.sdk:engage-android:7.1.1")
41
57
  testImplementation 'junit:junit:4.13.2'
42
- testImplementation 'org.mockito:mockito-core:5.14.2'
58
+ testImplementation 'org.mockito:mockito-core:5.23.0'
43
59
  testImplementation 'org.mockito:mockito-inline:5.2.0'
44
- testImplementation 'org.json:json:20240303'
45
- testImplementation 'org.robolectric:robolectric:4.13'
46
- }
47
-
48
- react {
49
- jsRootDir = rootDir
50
- libraryName = "RNMappPlugin"
51
- codegenJavaPackageName = "com.reactlibrary"
60
+ testImplementation 'org.json:json:20260522'
61
+ testImplementation 'org.robolectric:robolectric:4.16.1'
52
62
  }
@@ -5,7 +5,7 @@ pluginManagement {
5
5
  gradlePluginPortal()
6
6
  }
7
7
  plugins {
8
- id("com.android.library") version("9.1.0") // 👈 for library
8
+ id("com.android.library") version("9.1.1") // 👈 for library
9
9
  id("com.facebook.react") version("0.84.1") // 👈 for React Native
10
10
  }
11
11
  }
@@ -0,0 +1,232 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateModuleJavaSpec.js
9
+ *
10
+ * @nolint
11
+ */
12
+
13
+ package com.reactlibrary;
14
+
15
+ import com.facebook.proguard.annotations.DoNotStrip;
16
+ import com.facebook.react.bridge.Promise;
17
+ import com.facebook.react.bridge.ReactApplicationContext;
18
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
+ import com.facebook.react.bridge.ReactMethod;
20
+ import com.facebook.react.bridge.ReadableArray;
21
+ import com.facebook.react.bridge.ReadableMap;
22
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
23
+ import javax.annotation.Nonnull;
24
+
25
+ public abstract class NativeRNMappPluginModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
26
+ public static final String NAME = "RNMappPluginModule";
27
+
28
+ public NativeRNMappPluginModuleSpec(ReactApplicationContext reactContext) {
29
+ super(reactContext);
30
+ }
31
+
32
+ @Override
33
+ public @Nonnull String getName() {
34
+ return NAME;
35
+ }
36
+
37
+ @ReactMethod
38
+ @DoNotStrip
39
+ public abstract void requestGeofenceLocationPermission(Promise promise);
40
+
41
+ @ReactMethod
42
+ @DoNotStrip
43
+ public abstract void requestPostNotificationPermission(Promise promise);
44
+
45
+ @ReactMethod
46
+ @DoNotStrip
47
+ public abstract void setRemoteMessage(String msgJson, Promise promise);
48
+
49
+ @ReactMethod
50
+ @DoNotStrip
51
+ public abstract void isPushFromMapp(String msgJson, Promise promise);
52
+
53
+ @ReactMethod
54
+ @DoNotStrip
55
+ public abstract void setToken(String token, Promise promise);
56
+
57
+ @ReactMethod
58
+ @DoNotStrip
59
+ public abstract void getToken(Promise promise);
60
+
61
+ @ReactMethod
62
+ @DoNotStrip
63
+ public abstract void setAlias(String alias, Promise promise);
64
+
65
+ @ReactMethod
66
+ @DoNotStrip
67
+ public abstract void setAliasWithResend(String alias, boolean resendCustomAttributes, Promise promise);
68
+
69
+ @ReactMethod
70
+ @DoNotStrip
71
+ public abstract void getAlias(Promise promise);
72
+
73
+ @ReactMethod
74
+ @DoNotStrip
75
+ public abstract void engage2();
76
+
77
+ @ReactMethod
78
+ @DoNotStrip
79
+ public abstract void engage(String sdkKey, String googleProjectId, String server, String appID, String tenantID);
80
+
81
+ @ReactMethod
82
+ @DoNotStrip
83
+ public abstract void engageTestServer(String cepURl, String sdkKey, String googleProjectId, String server, String appID, String tenantID);
84
+
85
+ @ReactMethod
86
+ @DoNotStrip
87
+ public abstract void onInitCompletedListener(Promise promise);
88
+
89
+ @ReactMethod
90
+ @DoNotStrip
91
+ public abstract void isReady(Promise promise);
92
+
93
+ @ReactMethod
94
+ @DoNotStrip
95
+ public abstract void setPushEnabled(boolean optIn);
96
+
97
+ @ReactMethod
98
+ @DoNotStrip
99
+ public abstract void isPushEnabled(Promise promise);
100
+
101
+ @ReactMethod
102
+ @DoNotStrip
103
+ public abstract void setAttributes(ReadableMap attributes, Promise promise);
104
+
105
+ @ReactMethod
106
+ @DoNotStrip
107
+ public abstract void getAttributes(ReadableArray keys, Promise promise);
108
+
109
+ @ReactMethod
110
+ @DoNotStrip
111
+ public abstract void setAttribute(String key, String value);
112
+
113
+ @ReactMethod
114
+ @DoNotStrip
115
+ public abstract void setAttributeBoolean(String key, boolean value);
116
+
117
+ @ReactMethod
118
+ @DoNotStrip
119
+ public abstract void setAttributeInt(String key, double value);
120
+
121
+ @ReactMethod
122
+ @DoNotStrip
123
+ public abstract void removeAttribute(String attribute);
124
+
125
+ @ReactMethod
126
+ @DoNotStrip
127
+ public abstract void getAttributeStringValue(String key, Promise promise);
128
+
129
+ @ReactMethod
130
+ @DoNotStrip
131
+ public abstract void addTag(String tag);
132
+
133
+ @ReactMethod
134
+ @DoNotStrip
135
+ public abstract void removeTag(String tag);
136
+
137
+ @ReactMethod
138
+ @DoNotStrip
139
+ public abstract void getTags(Promise promise);
140
+
141
+ @ReactMethod
142
+ @DoNotStrip
143
+ public abstract void getDeviceInfo(Promise promise);
144
+
145
+ @ReactMethod
146
+ @DoNotStrip
147
+ public abstract void getDeviceDmcInfo(Promise promise);
148
+
149
+ @ReactMethod
150
+ @DoNotStrip
151
+ public abstract void isDeviceRegistered(Promise promise);
152
+
153
+ @ReactMethod
154
+ @DoNotStrip
155
+ public abstract void lockScreenOrientation(double orientation);
156
+
157
+ @ReactMethod
158
+ @DoNotStrip
159
+ public abstract void removeBadgeNumber();
160
+
161
+ @ReactMethod
162
+ @DoNotStrip
163
+ public abstract void startGeofencing(Promise promise);
164
+
165
+ @ReactMethod
166
+ @DoNotStrip
167
+ public abstract void stopGeofencing(Promise promise);
168
+
169
+ @ReactMethod
170
+ @DoNotStrip
171
+ public abstract void startGeoFencing();
172
+
173
+ @ReactMethod
174
+ @DoNotStrip
175
+ public abstract void stopGeoFencing();
176
+
177
+ @ReactMethod
178
+ @DoNotStrip
179
+ public abstract void fetchLatestInboxMessage(Promise promise);
180
+
181
+ @ReactMethod
182
+ @DoNotStrip
183
+ public abstract void fetchInboxMessage(Promise promise);
184
+
185
+ @ReactMethod
186
+ @DoNotStrip
187
+ public abstract void triggerInApp(String key);
188
+
189
+ @ReactMethod
190
+ @DoNotStrip
191
+ public abstract void inAppMarkAsRead(double templateId, String eventId);
192
+
193
+ @ReactMethod
194
+ @DoNotStrip
195
+ public abstract void inAppMarkAsUnRead(double templateId, String eventId);
196
+
197
+ @ReactMethod
198
+ @DoNotStrip
199
+ public abstract void inAppMarkAsDeleted(double templateId, String eventId);
200
+
201
+ @ReactMethod
202
+ @DoNotStrip
203
+ public abstract void triggerStatistic(double templateId, String originalEventId, String trackingKey, double displayMillis, String reason, String link);
204
+
205
+ @ReactMethod
206
+ @DoNotStrip
207
+ public abstract void addAndroidListener(String eventName);
208
+
209
+ @ReactMethod
210
+ @DoNotStrip
211
+ public abstract void removeAndroidListeners(double count);
212
+
213
+ @ReactMethod
214
+ @DoNotStrip
215
+ public abstract void addListener(String eventName);
216
+
217
+ @ReactMethod
218
+ @DoNotStrip
219
+ public abstract void removeListeners(double count);
220
+
221
+ @ReactMethod
222
+ @DoNotStrip
223
+ public abstract void clearNotifications();
224
+
225
+ @ReactMethod
226
+ @DoNotStrip
227
+ public abstract void clearNotification(double id);
228
+
229
+ @ReactMethod
230
+ @DoNotStrip
231
+ public abstract void logOut(boolean pushEnabled);
232
+ }
@@ -23,7 +23,7 @@ import androidx.core.content.ContextCompat;
23
23
 
24
24
  import com.appoxee.Appoxee;
25
25
  import com.appoxee.internal.model.response.DevicePayload;
26
- import com.appoxee.internal.model.response.inbox.InboxMessage;
26
+ import com.appoxee.shared.InboxMessage;
27
27
  import com.appoxee.sdk.BuildConfig;
28
28
  import com.appoxee.shared.AppoxeeObserver;
29
29
  import com.appoxee.shared.AppoxeeOptions;
@@ -34,7 +34,6 @@ import com.facebook.react.bridge.Callback;
34
34
  import com.facebook.react.bridge.LifecycleEventListener;
35
35
  import com.facebook.react.bridge.Promise;
36
36
  import com.facebook.react.bridge.ReactApplicationContext;
37
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
38
37
  import com.facebook.react.bridge.ReactMethod;
39
38
  import com.facebook.react.bridge.ReadableArray;
40
39
  import com.facebook.react.bridge.ReadableMap;
@@ -77,7 +76,7 @@ import java.util.concurrent.ConcurrentHashMap;
77
76
  */
78
77
  @SuppressWarnings("ALL")
79
78
  @ReactModule(name = RNMappPluginModule.NAME)
80
- public class RNMappPluginModule extends ReactContextBaseJavaModule implements PermissionListener {
79
+ public class RNMappPluginModule extends NativeRNMappPluginModuleSpec implements PermissionListener {
81
80
 
82
81
  public static final String NAME = "RNMappPluginModule";
83
82
  private static final int POST_NOTIFICATION_PERMISSION_REQUEST_CODE = 1001;
@@ -511,7 +510,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
511
510
  }
512
511
 
513
512
  @ReactMethod
514
- public void setAttributeBoolean(String key, Boolean value) {
513
+ public void setAttributeBoolean(String key, boolean value) {
515
514
  Map<String, Object> attr = new HashMap<>();
516
515
  attr.put(key, value);
517
516
  Appoxee.instance().addCustomAttributes(attr).enqueue(result -> {
@@ -519,9 +518,9 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
519
518
  }
520
519
 
521
520
  @ReactMethod
522
- public void setAttributeInt(String key, Integer value) {
521
+ public void setAttributeInt(String key, double value) {
523
522
  Map<String, Object> attr = new HashMap<>();
524
- attr.put(key, value);
523
+ attr.put(key, (int) value);
525
524
  Appoxee.instance().addCustomAttributes(attr).enqueue(result -> {
526
525
  });
527
526
  }
@@ -653,7 +652,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
653
652
  // -------------------------------------------------------------------------
654
653
 
655
654
  @ReactMethod
656
- public void lockScreenOrientation(Integer orientation) {
655
+ public void lockScreenOrientation(double orientation) {
657
656
  // setOrientation() removed in SDK v7 — no-op
658
657
  }
659
658
 
@@ -744,7 +743,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
744
743
  * The @ReactMethod signature is preserved to avoid breaking the JS public API.
745
744
  */
746
745
  @ReactMethod
747
- public void inAppMarkAsRead(Integer templateId, String eventId) {
746
+ public void inAppMarkAsRead(double templateId, String eventId) {
748
747
  // no-op in v7
749
748
  }
750
749
 
@@ -752,7 +751,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
752
751
  * @see #inAppMarkAsRead
753
752
  */
754
753
  @ReactMethod
755
- public void inAppMarkAsUnRead(Integer templateId, String eventId) {
754
+ public void inAppMarkAsUnRead(double templateId, String eventId) {
756
755
  // no-op in v7
757
756
  }
758
757
 
@@ -760,7 +759,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
760
759
  * @see #inAppMarkAsRead
761
760
  */
762
761
  @ReactMethod
763
- public void inAppMarkAsDeleted(Integer templateId, String eventId) {
762
+ public void inAppMarkAsDeleted(double templateId, String eventId) {
764
763
  // no-op in v7
765
764
  }
766
765
 
@@ -768,8 +767,8 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
768
767
  * @see #inAppMarkAsRead
769
768
  */
770
769
  @ReactMethod
771
- public void triggerStatistic(Integer templateId, String originalEventId,
772
- String trackingKey, int displayMillis,
770
+ public void triggerStatistic(double templateId, String originalEventId,
771
+ String trackingKey, double displayMillis,
773
772
  String reason, String link) {
774
773
  // no-op in v7
775
774
  }
@@ -784,8 +783,8 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
784
783
  }
785
784
 
786
785
  @ReactMethod
787
- public void removeAndroidListeners(int count) {
788
- EventEmitter.shared().removeAndroidListeners(count);
786
+ public void removeAndroidListeners(double count) {
787
+ EventEmitter.shared().removeAndroidListeners((int) count);
789
788
  }
790
789
 
791
790
  @ReactMethod
@@ -794,7 +793,7 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
794
793
  }
795
794
 
796
795
  @ReactMethod
797
- public void removeListeners(Integer count) {
796
+ public void removeListeners(double count) {
798
797
  removeAndroidListeners(count);
799
798
  }
800
799
 
@@ -808,8 +807,8 @@ public class RNMappPluginModule extends ReactContextBaseJavaModule implements Pe
808
807
  }
809
808
 
810
809
  @ReactMethod
811
- public void clearNotification(int id) {
812
- NotificationManagerCompat.from(reactContext.getApplicationContext()).cancel(id);
810
+ public void clearNotification(double id) {
811
+ NotificationManagerCompat.from(reactContext.getApplicationContext()).cancel((int) id);
813
812
  }
814
813
 
815
814
  // -------------------------------------------------------------------------
@@ -1,33 +1,30 @@
1
1
  package com.reactlibrary;
2
2
 
3
3
  import androidx.annotation.NonNull;
4
+ import androidx.annotation.Nullable;
4
5
 
5
- import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.BaseReactPackage;
6
7
  import com.facebook.react.bridge.NativeModule;
7
8
  import com.facebook.react.bridge.ReactApplicationContext;
8
9
  import com.facebook.react.module.model.ReactModuleInfo;
9
10
  import com.facebook.react.module.model.ReactModuleInfoProvider;
10
- import com.facebook.react.uimanager.ViewManager;
11
11
 
12
- import java.util.Collections;
13
12
  import java.util.HashMap;
14
- import java.util.List;
15
13
  import java.util.Map;
16
14
 
17
- public class RNMappPluginPackage implements ReactPackage {
15
+ public class RNMappPluginPackage extends BaseReactPackage {
18
16
 
19
- @NonNull
20
17
  @Override
21
- public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
22
- return Collections.singletonList(new RNMappPluginModule(reactContext));
18
+ @Nullable
19
+ public NativeModule getModule(@NonNull String name, @NonNull ReactApplicationContext reactContext) {
20
+ if (RNMappPluginModule.NAME.equals(name)) {
21
+ return new RNMappPluginModule(reactContext);
22
+ }
23
+ return null;
23
24
  }
24
25
 
25
26
  @NonNull
26
27
  @Override
27
- public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
28
- return Collections.emptyList();
29
- }
30
-
31
28
  public ReactModuleInfoProvider getReactModuleInfoProvider() {
32
29
  return () -> {
33
30
  Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
@@ -39,7 +36,6 @@ public class RNMappPluginPackage implements ReactPackage {
39
36
  RNMappPluginModule.NAME,
40
37
  false, // canOverrideExistingModule
41
38
  false, // needsEagerInit
42
- true, // hasConstants
43
39
  false, // isCxxModule
44
40
  true // isTurboModule -> THIS IS IMPORTANT
45
41
  )
@@ -49,4 +45,3 @@ public class RNMappPluginPackage implements ReactPackage {
49
45
  };
50
46
  }
51
47
  }
52
-
@@ -0,0 +1,28 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ cmake_minimum_required(VERSION 3.13)
7
+ set(CMAKE_VERBOSE_MAKEFILE on)
8
+
9
+ file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNMappPlugin/*.cpp)
10
+
11
+ add_library(
12
+ react_codegen_RNMappPlugin
13
+ OBJECT
14
+ ${react_codegen_SRCS}
15
+ )
16
+
17
+ target_include_directories(react_codegen_RNMappPlugin PUBLIC . react/renderer/components/RNMappPlugin)
18
+
19
+ target_link_libraries(
20
+ react_codegen_RNMappPlugin
21
+ fbjni
22
+ jsi
23
+ # We need to link different libraries based on whether we are building rncore or not, that's necessary
24
+ # because we want to break a circular dependency between react_codegen_rncore and reactnative
25
+ reactnative
26
+ )
27
+
28
+ target_compile_reactnative_options(react_codegen_RNMappPlugin PRIVATE)