infobip-mobile-messaging-react-native-plugin 6.4.2 → 6.4.5

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/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
  # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
3
3
  ruby '2.7.4'
4
- gem 'cocoapods', '~> 1.11', '>= 1.11.2'
4
+ gem 'cocoapods', '~> 1.11', '>= 1.11.3'
package/Gemfile.lock CHANGED
@@ -3,14 +3,14 @@ GEM
3
3
  specs:
4
4
  CFPropertyList (3.0.5)
5
5
  rexml
6
- activesupport (6.1.5)
6
+ activesupport (6.1.7)
7
7
  concurrent-ruby (~> 1.0, >= 1.0.2)
8
8
  i18n (>= 1.6, < 2)
9
9
  minitest (>= 5.1)
10
10
  tzinfo (~> 2.0)
11
11
  zeitwerk (~> 2.3)
12
- addressable (2.8.0)
13
- public_suffix (>= 2.0.2, < 5.0)
12
+ addressable (2.8.1)
13
+ public_suffix (>= 2.0.2, < 6.0)
14
14
  algoliasearch (1.27.5)
15
15
  httpclient (~> 2.8, >= 2.8.3)
16
16
  json (>= 1.5.1)
@@ -20,8 +20,8 @@ GEM
20
20
  addressable (~> 2.8)
21
21
  claide (>= 1.0.2, < 2.0)
22
22
  cocoapods-core (= 1.11.3)
23
- cocoapods-deintegrate (>= 1.0.5, < 2.0)
24
- cocoapods-downloader (>= 1.6.2, < 2.0)
23
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
24
+ cocoapods-downloader (>= 1.4.0, < 2.0)
25
25
  cocoapods-plugins (>= 1.0.0, < 2.0)
26
26
  cocoapods-search (>= 1.0.0, < 2.0)
27
27
  cocoapods-trunk (>= 1.4.0, < 2.0)
@@ -45,7 +45,7 @@ GEM
45
45
  public_suffix (~> 4.0)
46
46
  typhoeus (~> 1.0)
47
47
  cocoapods-deintegrate (1.0.5)
48
- cocoapods-downloader (1.5.1)
48
+ cocoapods-downloader (1.6.3)
49
49
  cocoapods-plugins (1.0.0)
50
50
  nap
51
51
  cocoapods-search (1.0.1)
@@ -54,43 +54,47 @@ GEM
54
54
  netrc (~> 0.11)
55
55
  cocoapods-try (1.2.0)
56
56
  colored2 (3.1.2)
57
- concurrent-ruby (1.1.9)
57
+ concurrent-ruby (1.1.10)
58
58
  escape (0.0.4)
59
- ethon (0.15.0)
59
+ ethon (0.16.0)
60
60
  ffi (>= 1.15.0)
61
61
  ffi (1.15.5)
62
62
  fourflusher (2.3.1)
63
63
  fuzzy_match (2.0.4)
64
64
  gh_inspector (1.1.3)
65
65
  httpclient (2.8.3)
66
- i18n (1.10.0)
66
+ i18n (1.12.0)
67
67
  concurrent-ruby (~> 1.0)
68
- json (2.6.1)
69
- minitest (5.15.0)
68
+ json (2.6.2)
69
+ minitest (5.16.3)
70
70
  molinillo (0.8.0)
71
71
  nanaimo (0.3.0)
72
72
  nap (1.1.0)
73
73
  netrc (0.11.0)
74
- public_suffix (4.0.6)
74
+ public_suffix (4.0.7)
75
75
  rexml (3.2.5)
76
76
  ruby-macho (2.5.1)
77
77
  typhoeus (1.4.0)
78
78
  ethon (>= 0.9.0)
79
- tzinfo (2.0.4)
79
+ tzinfo (2.0.5)
80
80
  concurrent-ruby (~> 1.0)
81
- xcodeproj (1.21.0)
81
+ xcodeproj (1.22.0)
82
82
  CFPropertyList (>= 2.3.3, < 4.0)
83
83
  atomos (~> 0.1.3)
84
84
  claide (>= 1.0.2, < 2.0)
85
85
  colored2 (~> 3.1)
86
86
  nanaimo (~> 0.3.0)
87
87
  rexml (~> 3.2.4)
88
- zeitwerk (2.5.4)
88
+ zeitwerk (2.6.6)
89
+
89
90
  PLATFORMS
90
91
  ruby
92
+
91
93
  DEPENDENCIES
92
- cocoapods (~> 1.11, >= 1.11.2)
94
+ cocoapods (~> 1.11, >= 1.11.3)
95
+
93
96
  RUBY VERSION
94
97
  ruby 2.7.4p191
98
+
95
99
  BUNDLED WITH
96
100
  2.2.27
@@ -1,7 +1,7 @@
1
- def defaultCompileSDKVersion = 31
2
- def defaultBuildToolsVersion = '31.0.0'
1
+ def defaultCompileSDKVersion = 33
2
+ def defaultBuildToolsVersion = '33.0.0'
3
3
  def defaultMinSDKVersion = 21
4
- def defaultTargetSDKVersion = 31
4
+ def defaultTargetSDKVersion = 33
5
5
 
6
6
  def getRootProjectProperty(property, fallback) {
7
7
  rootProject.ext.has(property) ? rootProject.ext.get(property) : fallback
@@ -33,7 +33,7 @@ buildscript {
33
33
  }
34
34
  }
35
35
  dependencies {
36
- classpath 'com.android.tools.build:gradle:4.2+'
36
+ classpath 'com.android.tools.build:gradle:7.2.2'
37
37
  }
38
38
  }
39
39
  }
@@ -85,7 +85,7 @@ repositories {
85
85
  }
86
86
 
87
87
  dependencies {
88
- def mmVersion = '6.4.3'
88
+ def mmVersion = '7.2.4'
89
89
 
90
90
  implementation 'com.facebook.react:react-native:+'
91
91
  implementation "androidx.annotation:annotation:1.1.0"
@@ -65,4 +65,4 @@ class Configuration {
65
65
 
66
66
  return config;
67
67
  }
68
- }
68
+ }
@@ -2,8 +2,11 @@ package org.infobip.reactlibrary.mobilemessaging;
2
2
 
3
3
  import android.content.Context;
4
4
  import android.os.Build;
5
+ import android.os.Bundle;
5
6
  import android.util.AttributeSet;
6
7
  import android.util.Log;
8
+ import android.view.LayoutInflater;
9
+ import android.view.View;
7
10
  import android.view.ViewGroup;
8
11
  import android.view.ViewTreeObserver;
9
12
  import android.widget.FrameLayout;
@@ -11,6 +14,8 @@ import android.widget.FrameLayout;
11
14
  import androidx.annotation.NonNull;
12
15
  import androidx.annotation.Nullable;
13
16
  import androidx.annotation.RequiresApi;
17
+ import androidx.appcompat.app.ActionBar;
18
+ import androidx.appcompat.app.AppCompatActivity;
14
19
  import androidx.fragment.app.Fragment;
15
20
  import androidx.fragment.app.FragmentActivity;
16
21
  import androidx.fragment.app.FragmentManager;
@@ -55,6 +60,25 @@ class ReactChatView extends FrameLayout {
55
60
  return;
56
61
  }
57
62
 
63
+ InAppChatFragment.InAppChatActionBarProvider provider = new InAppChatFragment.InAppChatActionBarProvider() {
64
+
65
+ @Nullable
66
+ @Override
67
+ public ActionBar getOriginalSupportActionBar() {
68
+ if (fragmentActivity instanceof AppCompatActivity){
69
+ return ((AppCompatActivity) fragmentActivity).getSupportActionBar();
70
+ }
71
+ return null;
72
+ }
73
+
74
+ @Override
75
+ public void onInAppChatBackPressed() {
76
+ if (fragmentActivity != null){
77
+ fragmentActivity.onBackPressed();
78
+ }
79
+ }
80
+ };
81
+
58
82
  //RN issue https://github.com/facebook/react-native/issues/17968
59
83
  //Without this layout will not be called and view will not be displayed, because RN doesn't dispatches events to android views properly
60
84
  ViewGroup parentView = (ViewGroup) parentLayout.findViewById(reactNativeViewId).getParent();
@@ -62,7 +86,7 @@ class ReactChatView extends FrameLayout {
62
86
 
63
87
  FragmentManager fragmentManager = fragmentActivity.getSupportFragmentManager();
64
88
  InAppChatFragment chatFragment = new InAppChatFragment();
65
- chatFragment.setIsToolbarHidden(true);
89
+ chatFragment.setInAppChatActionBarProvider(provider);
66
90
 
67
91
  FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
68
92
  if (fragmentManager.findFragmentByTag(Utils.RN_IN_APP_CHAT_FRAGMENT_TAG) == null) {
@@ -3,22 +3,47 @@ package org.infobip.reactlibrary.mobilemessaging;
3
3
  import android.annotation.SuppressLint;
4
4
  import android.app.Activity;
5
5
  import android.app.Application;
6
- import android.content.*;
6
+ import android.content.BroadcastReceiver;
7
+ import android.content.Context;
8
+ import android.content.DialogInterface;
9
+ import android.content.Intent;
10
+ import android.content.IntentFilter;
7
11
  import android.graphics.Color;
8
12
  import android.os.AsyncTask;
13
+ import android.os.Bundle;
9
14
  import android.util.Log;
10
15
 
11
16
  import androidx.annotation.NonNull;
12
17
  import androidx.annotation.Nullable;
18
+ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
13
19
 
14
20
  import com.facebook.react.ReactApplication;
15
- import com.facebook.react.bridge.*;
21
+ import com.facebook.react.bridge.ActivityEventListener;
22
+ import com.facebook.react.bridge.Callback;
23
+ import com.facebook.react.bridge.LifecycleEventListener;
24
+ import com.facebook.react.bridge.ReactApplicationContext;
25
+ import com.facebook.react.bridge.ReactContext;
26
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
27
+ import com.facebook.react.bridge.ReactMethod;
28
+ import com.facebook.react.bridge.ReadableArray;
29
+ import com.facebook.react.bridge.ReadableMap;
30
+ import com.facebook.react.modules.core.PermissionAwareActivity;
16
31
  import com.google.android.gms.common.ConnectionResult;
17
32
  import com.google.android.gms.common.GoogleApiAvailability;
18
33
 
19
- import org.infobip.mobile.messaging.*;
34
+ import org.infobip.mobile.messaging.BroadcastParameter;
35
+ import org.infobip.mobile.messaging.CustomEvent;
36
+ import org.infobip.mobile.messaging.Event;
37
+ import org.infobip.mobile.messaging.Installation;
38
+ import org.infobip.mobile.messaging.Message;
39
+ import org.infobip.mobile.messaging.MobileMessaging;
40
+ import org.infobip.mobile.messaging.MobileMessagingProperty;
41
+ import org.infobip.mobile.messaging.NotificationSettings;
42
+ import org.infobip.mobile.messaging.SuccessPending;
43
+ import org.infobip.mobile.messaging.User;
20
44
  import org.infobip.mobile.messaging.chat.InAppChat;
21
45
  import org.infobip.mobile.messaging.chat.core.InAppChatEvent;
46
+ import org.infobip.mobile.messaging.dal.bundle.MessageBundleMapper;
22
47
  import org.infobip.mobile.messaging.geo.GeoEvent;
23
48
  import org.infobip.mobile.messaging.geo.MobileGeo;
24
49
  import org.infobip.mobile.messaging.interactive.InteractiveEvent;
@@ -34,20 +59,23 @@ import org.infobip.mobile.messaging.storage.SQLiteMessageStore;
34
59
  import org.infobip.mobile.messaging.util.Cryptor;
35
60
  import org.infobip.mobile.messaging.util.DeviceInformation;
36
61
  import org.infobip.mobile.messaging.util.PreferenceHelper;
37
- import org.infobip.reactlibrary.mobilemessaging.datamappers.*;
38
- import org.infobip.mobile.messaging.dal.bundle.MessageBundleMapper;
62
+ import org.infobip.reactlibrary.mobilemessaging.datamappers.CustomEventJson;
63
+ import org.infobip.reactlibrary.mobilemessaging.datamappers.InstallationJson;
64
+ import org.infobip.reactlibrary.mobilemessaging.datamappers.MessageJson;
65
+ import org.infobip.reactlibrary.mobilemessaging.datamappers.PersonalizationCtx;
66
+ import org.infobip.reactlibrary.mobilemessaging.datamappers.ReactNativeJson;
67
+ import org.infobip.reactlibrary.mobilemessaging.datamappers.UserJson;
39
68
  import org.json.JSONArray;
40
69
  import org.json.JSONException;
41
70
  import org.json.JSONObject;
42
71
 
43
- import android.os.Bundle;
44
-
45
- import androidx.localbroadcastmanager.content.LocalBroadcastManager;
46
-
72
+ import java.util.ArrayList;
73
+ import java.util.Arrays;
74
+ import java.util.HashMap;
75
+ import java.util.List;
76
+ import java.util.Map;
47
77
  import java.util.concurrent.CopyOnWriteArrayList;
48
78
 
49
- import java.util.*;
50
-
51
79
  public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule implements LifecycleEventListener, ActivityEventListener {
52
80
  public static final String MODULE_NAME = "ReactNativeMobileMessaging";
53
81
 
@@ -300,7 +328,8 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
300
328
  PreferenceHelper.saveString(context, MobileMessagingProperty.SYSTEM_DATA_VERSION_POSTFIX, "reactNative " + configuration.reactNativePluginVersion);
301
329
 
302
330
  MobileMessaging.Builder builder = new MobileMessaging.Builder(context)
303
- .withApplicationCode(configuration.applicationCode);
331
+ .withApplicationCode(configuration.applicationCode)
332
+ .withoutRegisteringForRemoteNotifications();
304
333
 
305
334
  if (configuration.privacySettings.userDataPersistingDisabled) {
306
335
  builder.withoutStoringUserData();
@@ -411,7 +440,7 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
411
440
  try {
412
441
  reactContext.unregisterReceiver(commonLibraryBroadcastReceiver);
413
442
  LocalBroadcastManager.getInstance(reactContext).unregisterReceiver(messageStorageReceiver);
414
- } catch(IllegalArgumentException e) {
443
+ } catch (IllegalArgumentException e) {
415
444
  Log.d(Utils.TAG, "Can't unregister broadcast receivers");
416
445
  }
417
446
  broadcastReceiverRegistered = false;
@@ -686,6 +715,24 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
686
715
  });
687
716
  }
688
717
 
718
+ @ReactMethod
719
+ public void registerForAndroidRemoteNotifications() {
720
+ mobileMessaging().registerForRemoteNotifications((Activity) getPermissionAwareActivity());
721
+ }
722
+
723
+ private PermissionAwareActivity getPermissionAwareActivity() {
724
+ Activity activity = getCurrentActivity();
725
+ if (activity == null) {
726
+ throw new IllegalStateException(
727
+ "Tried to use permissions API while not attached to an " + "Activity.");
728
+ } else if (!(activity instanceof PermissionAwareActivity)) {
729
+ throw new IllegalStateException(
730
+ "Tried to use permissions API but the host Activity doesn't"
731
+ + " implement PermissionAwareActivity.");
732
+ }
733
+ return (PermissionAwareActivity) activity;
734
+ }
735
+
689
736
  private static void runInBackground(final Runnable runnable) {
690
737
  new AsyncTask<Void, Void, Void>() {
691
738
 
@@ -1,13 +1,13 @@
1
1
  package org.infobip.reactlibrary.mobilemessaging.datamappers;
2
2
 
3
3
  import android.util.Log;
4
- import com.facebook.react.bridge.ReadableMap;
5
- import org.infobip.mobile.messaging.*;
4
+
5
+ import com.google.gson.reflect.TypeToken;
6
+
7
+ import org.infobip.mobile.messaging.CustomAttributesMapper;
8
+ import org.infobip.mobile.messaging.CustomEvent;
6
9
  import org.infobip.mobile.messaging.api.appinstance.UserCustomEventAtts;
7
- import org.infobip.mobile.messaging.api.shaded.google.gson.reflect.TypeToken;
8
10
  import org.infobip.mobile.messaging.api.support.http.serialization.JsonSerializer;
9
- import org.json.JSONArray;
10
- import org.json.JSONException;
11
11
  import org.json.JSONObject;
12
12
 
13
13
  import java.lang.reflect.Type;
@@ -1,27 +1,28 @@
1
1
  package org.infobip.reactlibrary.mobilemessaging.datamappers;
2
2
 
3
- import org.infobip.mobile.messaging.*;
3
+ import androidx.annotation.NonNull;
4
4
 
5
+ import com.facebook.react.bridge.ReadableMap;
6
+ import com.google.gson.reflect.TypeToken;
7
+
8
+ import org.infobip.mobile.messaging.CustomAttributeValue;
9
+ import org.infobip.mobile.messaging.CustomAttributesMapper;
10
+ import org.infobip.mobile.messaging.User;
11
+ import org.infobip.mobile.messaging.UserAttributes;
12
+ import org.infobip.mobile.messaging.UserIdentity;
13
+ import org.infobip.mobile.messaging.UserMapper;
5
14
  import org.infobip.mobile.messaging.api.appinstance.UserAtts;
6
- import org.infobip.mobile.messaging.api.shaded.google.gson.reflect.TypeToken;
7
15
  import org.infobip.mobile.messaging.api.support.http.serialization.JsonSerializer;
8
-
9
16
  import org.infobip.mobile.messaging.util.DateTimeUtil;
10
17
  import org.json.JSONArray;
11
18
  import org.json.JSONException;
12
19
  import org.json.JSONObject;
13
20
 
14
- import androidx.annotation.NonNull;
15
- import androidx.annotation.Nullable;
16
-
17
- import com.facebook.react.bridge.ReadableMap;
18
-
21
+ import java.lang.reflect.Type;
19
22
  import java.text.ParseException;
20
23
  import java.util.Date;
21
24
  import java.util.HashSet;
22
- import java.util.List;
23
25
  import java.util.Map;
24
- import java.lang.reflect.Type;
25
26
  import java.util.Set;
26
27
 
27
28
  /**
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EmitterSubscription, Rationale } from "react-native";
1
+ import {EmitterSubscription, Rationale} from "react-native";
2
2
 
3
3
  declare namespace MobileMessagingReactNative {
4
4
  export type OS = 'Android' | 'iOS';
@@ -497,7 +497,12 @@ declare namespace MobileMessagingReactNative {
497
497
  * ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION
498
498
  * @return
499
499
  */
500
- requestAndroidPermissions(rationale?: Rationale): Promise<boolean>;
500
+ requestAndroidLocationPermissions(rationale?: Rationale): Promise<boolean>;
501
+
502
+ /**
503
+ * Registering for POST_NOTIFICATIONS permission for Android 13+
504
+ */
505
+ registerForAndroidRemoteNotifications(): void;
501
506
  }
502
507
  }
503
508
 
package/index.js CHANGED
@@ -547,7 +547,7 @@ class MobileMessaging {
547
547
  };
548
548
 
549
549
  /**
550
- * The predefined messages prompted within the In-app chat (such as status updates, button titles, input field prompt) by default are
550
+ * The predefined messages prompted within the In-app chat (such as status updates, button titles, input field prompt) by default are
551
551
  * localized using system locale setting, but can be easily changed providing your locale string with the following formats:
552
552
  * "es_ES", "es-ES" or "es"
553
553
  */
@@ -582,7 +582,17 @@ class MobileMessaging {
582
582
  */
583
583
  resetMessageCounter() {
584
584
  RNMMChat.resetMessageCounter();
585
- }
585
+ };
586
+
587
+ /**
588
+ * Registering for POST_NOTIFICATIONS permission for Android 13+
589
+ */
590
+ registerForAndroidRemoteNotifications() {
591
+ if (Platform.OS === "ios") {
592
+ return;
593
+ }
594
+ ReactNativeMobileMessaging.registerForAndroidRemoteNotifications();
595
+ };
586
596
 
587
597
  /* Geofencing permissions */
588
598
 
@@ -593,7 +603,7 @@ class MobileMessaging {
593
603
  * ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION
594
604
  * @return {Promise<boolean>}
595
605
  */
596
- async requestAndroidPermissions(rationale?: Rationale): Promise<Boolean> {
606
+ async requestAndroidLocationPermissions(rationale?: Rationale): Promise<Boolean> {
597
607
  const requiredPermissions = await this.requiredAndroidLocationPermissions();
598
608
  if (requiredPermissions.length === 0) {
599
609
  return Promise.resolve(true);
@@ -603,7 +613,7 @@ class MobileMessaging {
603
613
  if (!granted) {
604
614
  return Promise.resolve(false);
605
615
  } else {
606
- return this.requestAndroidPermissions(rationale);
616
+ return this.requestAndroidLocationPermissions(rationale);
607
617
  }
608
618
  });
609
619
  };
@@ -19,8 +19,8 @@ Pod::Spec.new do |s|
19
19
  s.requires_arc = true
20
20
 
21
21
  s.dependency "React-Core"
22
- s.dependency "MobileMessaging/Core", "10.4.1"
23
- s.dependency "MobileMessaging/Geofencing", "10.4.1"
24
- s.dependency "MobileMessaging/InAppChat", "10.4.1"
22
+ s.dependency "MobileMessaging/Core", "10.5.3"
23
+ s.dependency "MobileMessaging/Geofencing", "10.5.3"
24
+ s.dependency "MobileMessaging/InAppChat", "10.5.3"
25
25
 
26
26
  end
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "infobip-mobile-messaging-react-native-plugin",
3
3
  "title": "Infobip Mobile Messaging React Native Plugin",
4
- "version": "6.4.2",
4
+ "version": "6.4.5",
5
5
  "description": "Infobip Mobile Messaging React Native Plugin",
6
6
  "main": "index.js",
7
7
  "scripts": {
8
- "mm_build": "./scripts/build_mobile_messaging_framework.sh",
9
8
  "test": "echo \"Error: no test specified\" && exit 1"
10
9
  },
11
10
  "repository": {
package/ios/Cartfile DELETED
@@ -1 +0,0 @@
1
- github "infobip/mobile-messaging-sdk-ios" "10.4.1"
@@ -1 +0,0 @@
1
- github "infobip/mobile-messaging-sdk-ios" "10.4.1"
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
- echo "Building MobileMessaging.xcframework with Carthage started..."
3
- cd ios || { echo "[MobileMessagingPlugin] can't find ios folder"; exit 1; }
4
- carthage update --cache-builds --use-xcframeworks
5
- echo "Building MobileMessaging.xcframework with Carthage finished."
6
- cd -