infobip-mobile-messaging-react-native-plugin 6.4.5 → 6.4.6
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/android/build.gradle +5 -5
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/Configuration.java +1 -1
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/ReactChatView.java +1 -25
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/ReactNativeMobileMessagingModule.java +13 -60
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/datamappers/CustomEventJson.java +5 -5
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/datamappers/UserJson.java +10 -11
- package/index.d.ts +2 -7
- package/index.js +4 -14
- package/infobip-mobile-messaging-react-native-plugin-6.4.3.tgz +0 -0
- package/ios/Cartfile +1 -0
- package/ios/Cartfile.resolved +1 -0
- package/package.json +2 -1
- package/release.sh +1 -1
- package/scripts/build_mobile_messaging_framework.sh +6 -0
- package/infobip-mobile-messaging-react-native-plugin-6.4.4.tgz +0 -0
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
def defaultCompileSDKVersion =
|
|
2
|
-
def defaultBuildToolsVersion = '
|
|
1
|
+
def defaultCompileSDKVersion = 31
|
|
2
|
+
def defaultBuildToolsVersion = '31.0.0'
|
|
3
3
|
def defaultMinSDKVersion = 21
|
|
4
|
-
def defaultTargetSDKVersion =
|
|
4
|
+
def defaultTargetSDKVersion = 31
|
|
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:
|
|
36
|
+
classpath 'com.android.tools.build:gradle:4.2+'
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -85,7 +85,7 @@ repositories {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
dependencies {
|
|
88
|
-
def mmVersion = '
|
|
88
|
+
def mmVersion = '6.4.3'
|
|
89
89
|
|
|
90
90
|
implementation 'com.facebook.react:react-native:+'
|
|
91
91
|
implementation "androidx.annotation:annotation:1.1.0"
|
|
@@ -2,11 +2,8 @@ package org.infobip.reactlibrary.mobilemessaging;
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
import android.os.Build;
|
|
5
|
-
import android.os.Bundle;
|
|
6
5
|
import android.util.AttributeSet;
|
|
7
6
|
import android.util.Log;
|
|
8
|
-
import android.view.LayoutInflater;
|
|
9
|
-
import android.view.View;
|
|
10
7
|
import android.view.ViewGroup;
|
|
11
8
|
import android.view.ViewTreeObserver;
|
|
12
9
|
import android.widget.FrameLayout;
|
|
@@ -14,8 +11,6 @@ import android.widget.FrameLayout;
|
|
|
14
11
|
import androidx.annotation.NonNull;
|
|
15
12
|
import androidx.annotation.Nullable;
|
|
16
13
|
import androidx.annotation.RequiresApi;
|
|
17
|
-
import androidx.appcompat.app.ActionBar;
|
|
18
|
-
import androidx.appcompat.app.AppCompatActivity;
|
|
19
14
|
import androidx.fragment.app.Fragment;
|
|
20
15
|
import androidx.fragment.app.FragmentActivity;
|
|
21
16
|
import androidx.fragment.app.FragmentManager;
|
|
@@ -60,25 +55,6 @@ class ReactChatView extends FrameLayout {
|
|
|
60
55
|
return;
|
|
61
56
|
}
|
|
62
57
|
|
|
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
|
-
|
|
82
58
|
//RN issue https://github.com/facebook/react-native/issues/17968
|
|
83
59
|
//Without this layout will not be called and view will not be displayed, because RN doesn't dispatches events to android views properly
|
|
84
60
|
ViewGroup parentView = (ViewGroup) parentLayout.findViewById(reactNativeViewId).getParent();
|
|
@@ -86,7 +62,7 @@ class ReactChatView extends FrameLayout {
|
|
|
86
62
|
|
|
87
63
|
FragmentManager fragmentManager = fragmentActivity.getSupportFragmentManager();
|
|
88
64
|
InAppChatFragment chatFragment = new InAppChatFragment();
|
|
89
|
-
chatFragment.
|
|
65
|
+
chatFragment.setIsToolbarHidden(true);
|
|
90
66
|
|
|
91
67
|
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
|
92
68
|
if (fragmentManager.findFragmentByTag(Utils.RN_IN_APP_CHAT_FRAGMENT_TAG) == null) {
|
|
@@ -3,47 +3,22 @@ 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
|
|
7
|
-
import android.content.Context;
|
|
8
|
-
import android.content.DialogInterface;
|
|
9
|
-
import android.content.Intent;
|
|
10
|
-
import android.content.IntentFilter;
|
|
6
|
+
import android.content.*;
|
|
11
7
|
import android.graphics.Color;
|
|
12
8
|
import android.os.AsyncTask;
|
|
13
|
-
import android.os.Bundle;
|
|
14
9
|
import android.util.Log;
|
|
15
10
|
|
|
16
11
|
import androidx.annotation.NonNull;
|
|
17
12
|
import androidx.annotation.Nullable;
|
|
18
|
-
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
19
13
|
|
|
20
14
|
import com.facebook.react.ReactApplication;
|
|
21
|
-
import com.facebook.react.bridge
|
|
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;
|
|
15
|
+
import com.facebook.react.bridge.*;
|
|
31
16
|
import com.google.android.gms.common.ConnectionResult;
|
|
32
17
|
import com.google.android.gms.common.GoogleApiAvailability;
|
|
33
18
|
|
|
34
|
-
import org.infobip.mobile.messaging
|
|
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;
|
|
19
|
+
import org.infobip.mobile.messaging.*;
|
|
44
20
|
import org.infobip.mobile.messaging.chat.InAppChat;
|
|
45
21
|
import org.infobip.mobile.messaging.chat.core.InAppChatEvent;
|
|
46
|
-
import org.infobip.mobile.messaging.dal.bundle.MessageBundleMapper;
|
|
47
22
|
import org.infobip.mobile.messaging.geo.GeoEvent;
|
|
48
23
|
import org.infobip.mobile.messaging.geo.MobileGeo;
|
|
49
24
|
import org.infobip.mobile.messaging.interactive.InteractiveEvent;
|
|
@@ -59,23 +34,20 @@ import org.infobip.mobile.messaging.storage.SQLiteMessageStore;
|
|
|
59
34
|
import org.infobip.mobile.messaging.util.Cryptor;
|
|
60
35
|
import org.infobip.mobile.messaging.util.DeviceInformation;
|
|
61
36
|
import org.infobip.mobile.messaging.util.PreferenceHelper;
|
|
62
|
-
import org.infobip.reactlibrary.mobilemessaging.datamappers
|
|
63
|
-
import org.infobip.
|
|
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;
|
|
37
|
+
import org.infobip.reactlibrary.mobilemessaging.datamappers.*;
|
|
38
|
+
import org.infobip.mobile.messaging.dal.bundle.MessageBundleMapper;
|
|
68
39
|
import org.json.JSONArray;
|
|
69
40
|
import org.json.JSONException;
|
|
70
41
|
import org.json.JSONObject;
|
|
71
42
|
|
|
72
|
-
import
|
|
73
|
-
|
|
74
|
-
import
|
|
75
|
-
|
|
76
|
-
import java.util.Map;
|
|
43
|
+
import android.os.Bundle;
|
|
44
|
+
|
|
45
|
+
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
46
|
+
|
|
77
47
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
78
48
|
|
|
49
|
+
import java.util.*;
|
|
50
|
+
|
|
79
51
|
public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule implements LifecycleEventListener, ActivityEventListener {
|
|
80
52
|
public static final String MODULE_NAME = "ReactNativeMobileMessaging";
|
|
81
53
|
|
|
@@ -328,8 +300,7 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
328
300
|
PreferenceHelper.saveString(context, MobileMessagingProperty.SYSTEM_DATA_VERSION_POSTFIX, "reactNative " + configuration.reactNativePluginVersion);
|
|
329
301
|
|
|
330
302
|
MobileMessaging.Builder builder = new MobileMessaging.Builder(context)
|
|
331
|
-
.withApplicationCode(configuration.applicationCode)
|
|
332
|
-
.withoutRegisteringForRemoteNotifications();
|
|
303
|
+
.withApplicationCode(configuration.applicationCode);
|
|
333
304
|
|
|
334
305
|
if (configuration.privacySettings.userDataPersistingDisabled) {
|
|
335
306
|
builder.withoutStoringUserData();
|
|
@@ -440,7 +411,7 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
440
411
|
try {
|
|
441
412
|
reactContext.unregisterReceiver(commonLibraryBroadcastReceiver);
|
|
442
413
|
LocalBroadcastManager.getInstance(reactContext).unregisterReceiver(messageStorageReceiver);
|
|
443
|
-
} catch
|
|
414
|
+
} catch(IllegalArgumentException e) {
|
|
444
415
|
Log.d(Utils.TAG, "Can't unregister broadcast receivers");
|
|
445
416
|
}
|
|
446
417
|
broadcastReceiverRegistered = false;
|
|
@@ -715,24 +686,6 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
715
686
|
});
|
|
716
687
|
}
|
|
717
688
|
|
|
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
|
-
|
|
736
689
|
private static void runInBackground(final Runnable runnable) {
|
|
737
690
|
new AsyncTask<Void, Void, Void>() {
|
|
738
691
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
package org.infobip.reactlibrary.mobilemessaging.datamappers;
|
|
2
2
|
|
|
3
3
|
import android.util.Log;
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import org.infobip.mobile.messaging.CustomAttributesMapper;
|
|
8
|
-
import org.infobip.mobile.messaging.CustomEvent;
|
|
4
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
5
|
+
import org.infobip.mobile.messaging.*;
|
|
9
6
|
import org.infobip.mobile.messaging.api.appinstance.UserCustomEventAtts;
|
|
7
|
+
import org.infobip.mobile.messaging.api.shaded.google.gson.reflect.TypeToken;
|
|
10
8
|
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;
|
package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/datamappers/UserJson.java
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
package org.infobip.reactlibrary.mobilemessaging.datamappers;
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import org.infobip.mobile.messaging.*;
|
|
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;
|
|
14
5
|
import org.infobip.mobile.messaging.api.appinstance.UserAtts;
|
|
6
|
+
import org.infobip.mobile.messaging.api.shaded.google.gson.reflect.TypeToken;
|
|
15
7
|
import org.infobip.mobile.messaging.api.support.http.serialization.JsonSerializer;
|
|
8
|
+
|
|
16
9
|
import org.infobip.mobile.messaging.util.DateTimeUtil;
|
|
17
10
|
import org.json.JSONArray;
|
|
18
11
|
import org.json.JSONException;
|
|
19
12
|
import org.json.JSONObject;
|
|
20
13
|
|
|
21
|
-
import
|
|
14
|
+
import androidx.annotation.NonNull;
|
|
15
|
+
import androidx.annotation.Nullable;
|
|
16
|
+
|
|
17
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
18
|
+
|
|
22
19
|
import java.text.ParseException;
|
|
23
20
|
import java.util.Date;
|
|
24
21
|
import java.util.HashSet;
|
|
22
|
+
import java.util.List;
|
|
25
23
|
import java.util.Map;
|
|
24
|
+
import java.lang.reflect.Type;
|
|
26
25
|
import java.util.Set;
|
|
27
26
|
|
|
28
27
|
/**
|
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,12 +497,7 @@ declare namespace MobileMessagingReactNative {
|
|
|
497
497
|
* ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION
|
|
498
498
|
* @return
|
|
499
499
|
*/
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* Registering for POST_NOTIFICATIONS permission for Android 13+
|
|
504
|
-
*/
|
|
505
|
-
registerForAndroidRemoteNotifications(): void;
|
|
500
|
+
requestAndroidPermissions(rationale?: Rationale): Promise<boolean>;
|
|
506
501
|
}
|
|
507
502
|
}
|
|
508
503
|
|
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,17 +582,7 @@ class MobileMessaging {
|
|
|
582
582
|
*/
|
|
583
583
|
resetMessageCounter() {
|
|
584
584
|
RNMMChat.resetMessageCounter();
|
|
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
|
-
};
|
|
585
|
+
}
|
|
596
586
|
|
|
597
587
|
/* Geofencing permissions */
|
|
598
588
|
|
|
@@ -603,7 +593,7 @@ class MobileMessaging {
|
|
|
603
593
|
* ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION
|
|
604
594
|
* @return {Promise<boolean>}
|
|
605
595
|
*/
|
|
606
|
-
async
|
|
596
|
+
async requestAndroidPermissions(rationale?: Rationale): Promise<Boolean> {
|
|
607
597
|
const requiredPermissions = await this.requiredAndroidLocationPermissions();
|
|
608
598
|
if (requiredPermissions.length === 0) {
|
|
609
599
|
return Promise.resolve(true);
|
|
@@ -613,7 +603,7 @@ class MobileMessaging {
|
|
|
613
603
|
if (!granted) {
|
|
614
604
|
return Promise.resolve(false);
|
|
615
605
|
} else {
|
|
616
|
-
return this.
|
|
606
|
+
return this.requestAndroidPermissions(rationale);
|
|
617
607
|
}
|
|
618
608
|
});
|
|
619
609
|
};
|
|
Binary file
|
package/ios/Cartfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github "infobip/mobile-messaging-sdk-ios" "10.5.3"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github "infobip/mobile-messaging-sdk-ios" "10.5.3"
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "infobip-mobile-messaging-react-native-plugin",
|
|
3
3
|
"title": "Infobip Mobile Messaging React Native Plugin",
|
|
4
|
-
"version": "6.4.
|
|
4
|
+
"version": "6.4.6",
|
|
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",
|
|
8
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
10
|
},
|
|
10
11
|
"repository": {
|
package/release.sh
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
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 -
|
|
Binary file
|