infobip-mobile-messaging-react-native-plugin 9.2.3 → 9.4.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/README.md CHANGED
@@ -84,18 +84,6 @@ This guide is designed to get you up and running with Mobile Messaging SDK plugi
84
84
 
85
85
  3. Add a Firebase configuration file (google-services.json) as described in <a href="https://firebase.google.com/docs/android/setup#add-config-file" target="_blank">`Firebase documentation`</a>. Check <a href="https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Applying-Firebase-configuration-in-MobileMessaging-SDK">Applying Firebase configuration in MobileMessaging SDK Guide</a> for alternatives.
86
86
 
87
- > ### Notice (check if you don't plan to use [Geofencing](https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Geofencing#android)):
88
- > As long as Geofencing is automatically included to the plugin, it adds required geo permissions automatically. You can remove them from `/android/app/src/main/AndroidManifest.xml` by adding following:
89
- > ```
90
- > <manifest ... xmlns:tools="http://schemas.android.com/tools">
91
- > ...
92
- > <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" tools:node="remove" />
93
- > <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" tools:node="remove" />
94
- > <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove" />
95
- > ...
96
- > </manifest>
97
- > ```
98
-
99
87
  > ### Notice (when targeting Android 13):
100
88
  > Starting from Android 13, Google requires to ask user for notification permission. Follow [this guide](https://github.com/infobip/mobile-messaging-react-native-plugin/wiki/Android-13-Notification-Permission-Handling) to make a permission request.
101
89
 
@@ -11,6 +11,7 @@ def overrideGmsVersion = getRootProjectProperty('overrideGmsVersion', '')
11
11
  def overrideFirebaseVersion = getRootProjectProperty('overrideFirebaseVersion', '')
12
12
  def overrideKotlinVersion = getRootProjectProperty('overrideKotlinVersion', '')
13
13
  def withCryptorMigration = getRootProjectProperty('withCryptorMigration', false)
14
+ def withGeofencingModule = getRootProjectProperty('withGeofencingModule', false)
14
15
  def withWebRTCUI = getRootProjectProperty('withWebRTCUI', false)
15
16
 
16
17
  apply plugin: 'com.android.library'
@@ -86,7 +87,7 @@ repositories {
86
87
  }
87
88
 
88
89
  dependencies {
89
- def mmVersion = '11.1.4'
90
+ def mmVersion = "12.1.0"
90
91
  //react and mm dependencies clash
91
92
  if (!overrideKotlinVersion.empty) {
92
93
  constraints {
@@ -99,10 +100,10 @@ dependencies {
99
100
  implementation 'com.google.android.material:material:1.8.0'
100
101
  implementation 'androidx.exifinterface:exifinterface:1.3.6'
101
102
  implementation 'androidx.databinding:viewbinding:8.0.2'
103
+ implementation 'com.google.android.gms:play-services-base:18.2.0'
102
104
 
103
105
  implementation "com.infobip:infobip-mobile-messaging-android-resources:$mmVersion@aar"
104
106
  implementation "com.infobip:infobip-mobile-messaging-android-chat-sdk:$mmVersion@aar"
105
- implementation "com.infobip:infobip-mobile-messaging-android-geo-sdk:$mmVersion@aar"
106
107
  implementation ("com.infobip:infobip-mobile-messaging-android-sdk:$mmVersion@aar") {
107
108
  transitive = true;
108
109
 
@@ -128,4 +129,10 @@ dependencies {
128
129
  if (withCryptorMigration.toBoolean()) {
129
130
  implementation "com.infobip:infobip-mobile-messaging-android-cryptor-migration:$mmVersion@aar"
130
131
  }
132
+
133
+ if (withGeofencingModule.toBoolean()) {
134
+ implementation ("com.infobip:infobip-mobile-messaging-android-geo-sdk:$mmVersion@aar"){
135
+ transitive = true
136
+ }
137
+ }
131
138
  }
@@ -47,8 +47,6 @@ import org.infobip.mobile.messaging.User;
47
47
  import org.infobip.mobile.messaging.chat.InAppChat;
48
48
  import org.infobip.mobile.messaging.chat.core.InAppChatEvent;
49
49
  import org.infobip.mobile.messaging.dal.bundle.MessageBundleMapper;
50
- import org.infobip.mobile.messaging.geo.GeoEvent;
51
- import org.infobip.mobile.messaging.geo.MobileGeo;
52
50
  import org.infobip.mobile.messaging.interactive.InteractiveEvent;
53
51
  import org.infobip.mobile.messaging.interactive.MobileInteractive;
54
52
  import org.infobip.mobile.messaging.interactive.NotificationAction;
@@ -72,6 +70,7 @@ import org.json.JSONArray;
72
70
  import org.json.JSONException;
73
71
  import org.json.JSONObject;
74
72
 
73
+ import java.lang.reflect.Method;
75
74
  import java.util.ArrayList;
76
75
  import java.util.Arrays;
77
76
  import java.util.HashMap;
@@ -163,6 +162,10 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
163
162
  private static final String EVENT_INAPPCHAT_LIVECHAT_REGISTRATION_ID_UPDATED = "inAppChat.livechatRegistrationIdUpdated";
164
163
  //endregion
165
164
 
165
+ //Geo dependency is opt-out by default. Extracted from GeoEvent.GEOFENCE_AREA_ENTERED module 'infobip-mobile-messaging-android-geo-sdk'
166
+ private static final String GEO_EVENT_GEOFENCE_AREA_ENTERED_KEY = "org.infobip.mobile.messaging.geo.GEOFENCE_AREA_ENTERED";
167
+
168
+
166
169
  //region MessageStorageBroadcastReceiver
167
170
  private static final Map<String, String> messageStorageEventMap = new HashMap<String, String>() {{
168
171
  put(MessageStoreAdapter.EVENT_MESSAGESTORAGE_START, MessageStoreAdapter.EVENT_MESSAGESTORAGE_START);
@@ -282,7 +285,7 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
282
285
  put(Event.USER_UPDATED.getKey(), EVENT_USER_UPDATED);
283
286
  put(Event.PERSONALIZED.getKey(), EVENT_PERSONALIZED);
284
287
  put(Event.DEPERSONALIZED.getKey(), EVENT_DEPERSONALIZED);
285
- put(GeoEvent.GEOFENCE_AREA_ENTERED.getKey(), EVENT_GEOFENCE_ENTERED);
288
+ put(GEO_EVENT_GEOFENCE_AREA_ENTERED_KEY, EVENT_GEOFENCE_ENTERED);
286
289
  put(InAppChatEvent.CHAT_VIEW_CHANGED.getKey(), EVENT_INAPPCHAT_VIEW_STATE_CHANGED);
287
290
  put(InAppChatEvent.CHAT_CONFIGURATION_SYNCED.getKey(), EVENT_INAPPCHAT_CONFIGURATION_SYNCED);
288
291
  put(InAppChatEvent.LIVECHAT_REGISTRATION_ID_UPDATED.getKey(), EVENT_INAPPCHAT_LIVECHAT_REGISTRATION_ID_UPDATED);
@@ -298,7 +301,7 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
298
301
  return;
299
302
  }
300
303
 
301
- if (GeoEvent.GEOFENCE_AREA_ENTERED.getKey().equals(intent.getAction())) {
304
+ if (GEO_EVENT_GEOFENCE_AREA_ENTERED_KEY.equals(intent.getAction())) {
302
305
  for (JSONObject geo : MessageJson.geosFromBundle(intent.getExtras())) {
303
306
  ReactNativeEvent.send(event, reactContext, geo);
304
307
  }
@@ -447,7 +450,16 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
447
450
  @Override
448
451
  public void onSuccess() {
449
452
  if (configuration.geofencingEnabled) {
450
- MobileGeo.getInstance(context).activateGeofencing();
453
+ try {
454
+ Class<?> cls = Class.forName("org.infobip.mobile.messaging.geo.MobileGeo");
455
+ Method newInstance_method = cls.getDeclaredMethod("getInstance", Context.class);
456
+ Method activateGeofencing_method = cls.getDeclaredMethod("activateGeofencing");
457
+ Object geoInstance = newInstance_method.invoke(cls, context);
458
+ activateGeofencing_method.invoke(geoInstance);
459
+ } catch (Exception e) {
460
+ Log.d(Utils.TAG, "Geofencing is not enabled.");
461
+ e.printStackTrace();
462
+ }
451
463
  }
452
464
 
453
465
  NotificationCategory categories[] = notificationCategoriesFromConfiguration(configuration.notificationCategories);
@@ -6,9 +6,9 @@ import android.util.Log;
6
6
 
7
7
  import org.infobip.reactlibrary.mobilemessaging.Utils;
8
8
 
9
+ import java.lang.reflect.Method;
10
+
9
11
  import org.infobip.mobile.messaging.Message;
10
- import org.infobip.mobile.messaging.geo.Area;
11
- import org.infobip.mobile.messaging.geo.Geo;
12
12
  import org.json.JSONArray;
13
13
  import org.json.JSONException;
14
14
  import org.json.JSONObject;
@@ -144,31 +144,16 @@ public class MessageJson {
144
144
  */
145
145
  @NonNull
146
146
  public static List<JSONObject> geosFromBundle(Bundle bundle) {
147
- Geo geo = Geo.createFrom(bundle);
148
- JSONObject message = bundleToJSON(bundle);
149
- if (geo == null || geo.getAreasList() == null || geo.getAreasList().isEmpty() || message == null) {
150
- return new ArrayList<JSONObject>();
151
- }
152
-
153
- List<JSONObject> geos = new ArrayList<JSONObject>();
154
- for (final Area area : geo.getAreasList()) {
155
- try {
156
- geos.add(new JSONObject()
157
- .put("area", new JSONObject()
158
- .put("id", area.getId())
159
- .put("center", new JSONObject()
160
- .put("lat", area.getLatitude())
161
- .put("lon", area.getLongitude()))
162
- .put("radius", area.getRadius())
163
- .put("title", area.getTitle()))
164
- );
165
- } catch (JSONException e) {
166
- Log.w(Utils.TAG, "Cannot convert geo to JSON: " + e.getMessage());
167
- Log.d(Utils.TAG, Log.getStackTraceString(e));
168
- }
147
+ try {
148
+ Class<?> cls = Class.forName("org.infobip.mobile.messaging.geo.mapper.GeoBundleMapper");
149
+ Method geosFromBundle_method = cls.getDeclaredMethod("geosFromBundle", Bundle.class);
150
+ List<JSONObject> geos = (List<JSONObject>) geosFromBundle_method.invoke(cls, bundle);
151
+ return geos;
152
+ } catch (Exception e) {
153
+ Log.w(Utils.TAG, "Cannot convert geo to JSON: " + e.getMessage());
154
+ Log.d(Utils.TAG, Log.getStackTraceString(e));
169
155
  }
170
-
171
- return geos;
156
+ return new ArrayList<JSONObject>();
172
157
  }
173
158
 
174
159
  @NonNull
@@ -188,4 +173,4 @@ public class MessageJson {
188
173
  }
189
174
  return messages;
190
175
  }
191
- }
176
+ }
@@ -19,10 +19,10 @@ Pod::Spec.new do |s|
19
19
  s.requires_arc = true
20
20
 
21
21
  s.dependency "React-Core"
22
- s.dependency "MobileMessaging/Core", "12.2.3"
23
- s.dependency "MobileMessaging/Geofencing", "12.2.3"
24
- s.dependency "MobileMessaging/InAppChat", "12.2.3"
22
+ s.dependency "MobileMessaging/Core", "12.3.1"
23
+ s.dependency "MobileMessaging/Geofencing", "12.3.1"
24
+ s.dependency "MobileMessaging/InAppChat", "12.3.1"
25
25
  if defined?($WebRTCUIEnabled)
26
- s.dependency "MobileMessaging/WebRTCUI", "12.2.3"
26
+ s.dependency "MobileMessaging/WebRTCUI", "12.3.1"
27
27
  end
28
28
  end
@@ -106,7 +106,8 @@ class RNMMChat: NSObject {
106
106
  let localeS = String(localeString)
107
107
  let separator = localeS.contains("_") ? "_" : "-"
108
108
  let components = localeS.components(separatedBy: separator)
109
- let lang = MMLanguage.mapLanguage(from: components.first ??
109
+ let langCode = localeS.contains("zh") ? localeS : components.first
110
+ let lang = MMLanguage.mapLanguage(from: langCode ??
110
111
  String(localeS.prefix(2)))
111
112
  chatVC.setLanguage(lang) { error in
112
113
  if let error = error {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "infobip-mobile-messaging-react-native-plugin",
3
3
  "title": "Infobip Mobile Messaging React Native Plugin",
4
- "version": "9.2.3",
4
+ "version": "9.4.0",
5
5
  "description": "Infobip Mobile Messaging React Native Plugin",
6
6
  "main": "./src/index.js",
7
7
  "scripts": {