infobip-mobile-messaging-react-native-plugin 12.2.0 → 12.3.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/android/build.gradle +0 -6
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/Configuration.java +0 -1
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/ReactNativeMobileMessagingModule.java +0 -25
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/datamappers/MessageJson.java +0 -34
- package/infobip-mobile-messaging-react-native-plugin-12.2.0.tgz +0 -0
- package/infobip-mobile-messaging-react-native-plugin.podspec +0 -1
- package/infobip-mobile-messaging-react-native-plugin.tgz +0 -0
- package/ios/MobileMessagingPlugin/RNMobileMessaging.swift +0 -5
- package/ios/MobileMessagingPlugin/RNMobileMessagingConfiguration.swift +0 -3
- package/ios/MobileMessagingPlugin/RNMobileMessagingEventsManager.swift +0 -6
- package/ios/MobileMessagingPlugin/RNMobileMessagingUtils.swift +0 -24
- package/package.json +1 -1
- package/src/index.d.ts +0 -30
- package/src/index.js +0 -65
- package/infobip-mobile-messaging-react-native-plugin-12.1.0.tgz +0 -0
package/android/build.gradle
CHANGED
|
@@ -11,7 +11,6 @@ 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)
|
|
15
14
|
def withWebRTCUI = getRootProjectProperty('withWebRTCUI', false)
|
|
16
15
|
|
|
17
16
|
apply plugin: 'com.android.library'
|
|
@@ -131,9 +130,4 @@ dependencies {
|
|
|
131
130
|
implementation "com.infobip:infobip-mobile-messaging-android-cryptor-migration:$mmVersion@aar"
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
if (withGeofencingModule.toBoolean()) {
|
|
135
|
-
implementation ("com.infobip:infobip-mobile-messaging-android-geo-sdk:$mmVersion@aar"){
|
|
136
|
-
transitive = true
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
133
|
}
|
|
@@ -161,7 +161,6 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
161
161
|
private static final String EVENT_PERSONALIZED = "personalized";
|
|
162
162
|
private static final String EVENT_DEPERSONALIZED = "depersonalized";
|
|
163
163
|
|
|
164
|
-
private static final String EVENT_GEOFENCE_ENTERED = "geofenceEntered";
|
|
165
164
|
private static final String EVENT_NOTIFICATION_TAPPED = "notificationTapped";
|
|
166
165
|
private static final String EVENT_NOTIFICATION_ACTION_TAPPED = "actionTapped";
|
|
167
166
|
private static final String EVENT_MESSAGE_RECEIVED = "messageReceived";
|
|
@@ -173,9 +172,6 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
173
172
|
private static final String EVENT_INAPPCHAT_AVAILABILITY_UPDATED = "inAppChat.availabilityUpdated";
|
|
174
173
|
//endregion
|
|
175
174
|
|
|
176
|
-
//Geo dependency is opt-out by default. Extracted from GeoEvent.GEOFENCE_AREA_ENTERED module 'infobip-mobile-messaging-android-geo-sdk'
|
|
177
|
-
private static final String GEO_EVENT_GEOFENCE_AREA_ENTERED_KEY = "org.infobip.mobile.messaging.geo.GEOFENCE_AREA_ENTERED";
|
|
178
|
-
|
|
179
175
|
|
|
180
176
|
//region MessageStorageBroadcastReceiver
|
|
181
177
|
private static final Map<String, String> messageStorageEventMap = new HashMap<String, String>() {{
|
|
@@ -296,7 +292,6 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
296
292
|
put(Event.USER_UPDATED.getKey(), EVENT_USER_UPDATED);
|
|
297
293
|
put(Event.PERSONALIZED.getKey(), EVENT_PERSONALIZED);
|
|
298
294
|
put(Event.DEPERSONALIZED.getKey(), EVENT_DEPERSONALIZED);
|
|
299
|
-
put(GEO_EVENT_GEOFENCE_AREA_ENTERED_KEY, EVENT_GEOFENCE_ENTERED);
|
|
300
295
|
put(InAppChatEvent.CHAT_VIEW_CHANGED.getKey(), EVENT_INAPPCHAT_VIEW_STATE_CHANGED);
|
|
301
296
|
put(InAppChatEvent.CHAT_CONFIGURATION_SYNCED.getKey(), EVENT_INAPPCHAT_CONFIGURATION_SYNCED);
|
|
302
297
|
put(InAppChatEvent.LIVECHAT_REGISTRATION_ID_UPDATED.getKey(), EVENT_INAPPCHAT_LIVECHAT_REGISTRATION_ID_UPDATED);
|
|
@@ -313,13 +308,6 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
313
308
|
return;
|
|
314
309
|
}
|
|
315
310
|
|
|
316
|
-
if (GEO_EVENT_GEOFENCE_AREA_ENTERED_KEY.equals(intent.getAction())) {
|
|
317
|
-
for (JSONObject geo : MessageJson.geosFromBundle(intent.getExtras())) {
|
|
318
|
-
ReactNativeEvent.send(event, reactContext, geo);
|
|
319
|
-
}
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
311
|
if (Event.INSTALLATION_UPDATED.getKey().equals(intent.getAction())) {
|
|
324
312
|
JSONObject updatedInstallation = InstallationJson.toJSON(Installation.createFrom(intent.getExtras()));
|
|
325
313
|
ReactNativeEvent.send(event, reactContext, updatedInstallation);
|
|
@@ -471,19 +459,6 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
471
459
|
@SuppressLint("MissingPermission")
|
|
472
460
|
@Override
|
|
473
461
|
public void onSuccess() {
|
|
474
|
-
if (configuration.geofencingEnabled) {
|
|
475
|
-
try {
|
|
476
|
-
Class<?> cls = Class.forName("org.infobip.mobile.messaging.geo.MobileGeo");
|
|
477
|
-
Method newInstance_method = cls.getDeclaredMethod("getInstance", Context.class);
|
|
478
|
-
Method activateGeofencing_method = cls.getDeclaredMethod("activateGeofencing");
|
|
479
|
-
Object geoInstance = newInstance_method.invoke(cls, context);
|
|
480
|
-
activateGeofencing_method.invoke(geoInstance);
|
|
481
|
-
} catch (Exception e) {
|
|
482
|
-
Log.d(Utils.TAG, "Geofencing is not enabled.");
|
|
483
|
-
e.printStackTrace();
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
462
|
NotificationCategory categories[] = notificationCategoriesFromConfiguration(configuration.notificationCategories);
|
|
488
463
|
if (categories.length > 0) {
|
|
489
464
|
MobileInteractive.getInstance(context).setNotificationCategories(categories);
|
package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/datamappers/MessageJson.java
CHANGED
|
@@ -54,7 +54,6 @@ public class MessageJson {
|
|
|
54
54
|
.putOpt("contentUrl", message.getContentUrl())
|
|
55
55
|
.putOpt("seen", message.getSeenTimestamp() != 0)
|
|
56
56
|
.putOpt("seenDate", message.getSeenTimestamp())
|
|
57
|
-
.putOpt("geo", hasGeo(message))
|
|
58
57
|
.putOpt("chat", message.isChatMessage())
|
|
59
58
|
.putOpt("browserUrl", message.getBrowserUrl())
|
|
60
59
|
.putOpt("webViewUrl", message.getWebViewUrl())
|
|
@@ -68,19 +67,6 @@ public class MessageJson {
|
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
private static boolean hasGeo(Message message) {
|
|
72
|
-
if (message == null || message.getInternalData() == null) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
try {
|
|
77
|
-
JSONObject geo = new JSONObject(message.getInternalData());
|
|
78
|
-
return geo.getJSONArray("geo") != null && geo.getJSONArray("geo").length() > 0;
|
|
79
|
-
} catch (JSONException e) {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
70
|
/**
|
|
85
71
|
* Creates array of json objects from list of messages
|
|
86
72
|
*
|
|
@@ -135,26 +121,6 @@ public class MessageJson {
|
|
|
135
121
|
return message;
|
|
136
122
|
}
|
|
137
123
|
|
|
138
|
-
/**
|
|
139
|
-
* Geo mapper
|
|
140
|
-
*
|
|
141
|
-
* @param bundle where to read geo objects from
|
|
142
|
-
* @return list of json objects representing geo objects
|
|
143
|
-
*/
|
|
144
|
-
@NonNull
|
|
145
|
-
public static List<JSONObject> geosFromBundle(Bundle bundle) {
|
|
146
|
-
try {
|
|
147
|
-
Class<?> cls = Class.forName("org.infobip.mobile.messaging.geo.mapper.GeoBundleMapper");
|
|
148
|
-
Method geosFromBundle_method = cls.getDeclaredMethod("geosFromBundle", Bundle.class);
|
|
149
|
-
List<JSONObject> geos = (List<JSONObject>) geosFromBundle_method.invoke(cls, bundle);
|
|
150
|
-
return geos;
|
|
151
|
-
} catch (Exception e) {
|
|
152
|
-
Log.w(Utils.TAG, "Cannot convert geo to JSON: " + e.getMessage());
|
|
153
|
-
Log.d(Utils.TAG, Log.getStackTraceString(e));
|
|
154
|
-
}
|
|
155
|
-
return new ArrayList<JSONObject>();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
124
|
@NonNull
|
|
159
125
|
public static List<Message> resolveMessages(JSONArray args) throws JSONException {
|
|
160
126
|
if (args == null || args.length() < 1 || args.getString(0) == null) {
|
|
Binary file
|
|
@@ -20,7 +20,6 @@ Pod::Spec.new do |s|
|
|
|
20
20
|
|
|
21
21
|
s.dependency "React-Core"
|
|
22
22
|
s.dependency "MobileMessaging/Core", "12.13.2"
|
|
23
|
-
s.dependency "MobileMessaging/Geofencing", "12.13.2"
|
|
24
23
|
s.dependency "MobileMessaging/InAppChat", "12.13.2"
|
|
25
24
|
s.dependency "MobileMessaging/Inbox", "12.13.2"
|
|
26
25
|
if defined?($WebRTCUIEnabled)
|
|
Binary file
|
|
@@ -27,7 +27,6 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
|
27
27
|
EventName.userUpdated,
|
|
28
28
|
EventName.personalized,
|
|
29
29
|
EventName.depersonalized,
|
|
30
|
-
EventName.geofenceEntered,
|
|
31
30
|
EventName.actionTapped,
|
|
32
31
|
EventName.notificationTapped,
|
|
33
32
|
EventName.messageReceived,
|
|
@@ -123,10 +122,6 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
|
123
122
|
|
|
124
123
|
var mobileMessaging = MobileMessaging.withApplicationCode(configuration.appCode, notificationType: configuration.notificationType)
|
|
125
124
|
|
|
126
|
-
if configuration.geofencingEnabled {
|
|
127
|
-
mobileMessaging = mobileMessaging?.withGeofencingService()
|
|
128
|
-
}
|
|
129
|
-
|
|
130
125
|
if let storageAdapter = messageStorageAdapter, configuration.messageStorageEnabled {
|
|
131
126
|
mobileMessaging = mobileMessaging?.withMessageStorage(storageAdapter)
|
|
132
127
|
} else if configuration.defaultMessageStorage {
|
|
@@ -17,7 +17,6 @@ class RNMobileMessagingConfiguration {
|
|
|
17
17
|
static let carrierInfoSendingDisabled = "carrierInfoSendingDisabled"
|
|
18
18
|
static let systemInfoSendingDisabled = "systemInfoSendingDisabled"
|
|
19
19
|
static let applicationCodePersistingDisabled = "applicationCodePersistingDisabled"
|
|
20
|
-
static let geofencingEnabled = "geofencingEnabled"
|
|
21
20
|
static let applicationCode = "applicationCode"
|
|
22
21
|
static let webRTCUI = "webRTCUI"
|
|
23
22
|
static let configurationId = "configurationId"
|
|
@@ -34,7 +33,6 @@ class RNMobileMessagingConfiguration {
|
|
|
34
33
|
|
|
35
34
|
let appCode: String
|
|
36
35
|
let webRTCUI: [String: AnyObject]?
|
|
37
|
-
let geofencingEnabled: Bool
|
|
38
36
|
let messageStorageEnabled: Bool
|
|
39
37
|
let defaultMessageStorage: Bool
|
|
40
38
|
let notificationType: MMUserNotificationType
|
|
@@ -55,7 +53,6 @@ class RNMobileMessagingConfiguration {
|
|
|
55
53
|
|
|
56
54
|
self.appCode = appCode
|
|
57
55
|
self.webRTCUI = rawConfig[RNMobileMessagingConfiguration.Keys.webRTCUI] as? [String: AnyObject]
|
|
58
|
-
self.geofencingEnabled = rawConfig[RNMobileMessagingConfiguration.Keys.geofencingEnabled].unwrap(orDefault: false)
|
|
59
56
|
self.logging = ios[RNMobileMessagingConfiguration.Keys.logging].unwrap(orDefault: false)
|
|
60
57
|
self.defaultMessageStorage = rawConfig[RNMobileMessagingConfiguration.Keys.defaultMessageStorage].unwrap(orDefault: false)
|
|
61
58
|
self.messageStorageEnabled = rawConfig[RNMobileMessagingConfiguration.Keys.messageStorage] != nil ? true : false
|
|
@@ -17,7 +17,6 @@ class RNMobileMessagingEventsManager {
|
|
|
17
17
|
EventName.messageReceived: MMNotificationMessageReceived,
|
|
18
18
|
EventName.tokenReceived: MMNotificationDeviceTokenReceived,
|
|
19
19
|
EventName.registrationUpdated: MMNotificationRegistrationUpdated,
|
|
20
|
-
EventName.geofenceEntered: MMNotificationGeographicalRegionDidEnter,
|
|
21
20
|
EventName.notificationTapped: MMNotificationMessageTapped,
|
|
22
21
|
EventName.actionTapped: MMNotificationActionTapped,
|
|
23
22
|
EventName.depersonalized: MMNotificationDepersonalized,
|
|
@@ -85,11 +84,6 @@ class RNMobileMessagingEventsManager {
|
|
|
85
84
|
if let internalId = notification.userInfo?[MMNotificationKeyRegistrationInternalId] as? String {
|
|
86
85
|
notificationResult = internalId
|
|
87
86
|
}
|
|
88
|
-
case MMNotificationGeographicalRegionDidEnter:
|
|
89
|
-
eventName = EventName.geofenceEntered
|
|
90
|
-
if let region = notification.userInfo?[MMNotificationKeyGeographicalRegion] as? MMRegion {
|
|
91
|
-
notificationResult = region.dictionary()
|
|
92
|
-
}
|
|
93
87
|
case MMNotificationMessageTapped:
|
|
94
88
|
eventName = EventName.notificationTapped
|
|
95
89
|
if let message = notification.userInfo?[MMNotificationKeyMessage] as? MM_MTMessage {
|
|
@@ -21,7 +21,6 @@ extension MM_MTMessage {
|
|
|
21
21
|
result["contentUrl"] = contentUrl
|
|
22
22
|
result["seen"] = seenStatus != .NotSeen
|
|
23
23
|
result["seenDate"] = seenDate?.timeIntervalSince1970
|
|
24
|
-
result["geo"] = isGeoMessage
|
|
25
24
|
result["chat"] = isChatMessage
|
|
26
25
|
result["browserUrl"] = browserUrl?.absoluteString
|
|
27
26
|
result["deeplink"] = deeplink?.absoluteString
|
|
@@ -31,10 +30,6 @@ extension MM_MTMessage {
|
|
|
31
30
|
return result
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
var isGeoMessage: Bool {
|
|
35
|
-
let geoAreasDicts = (originalPayload["internalData"] as? [String: Any])?["geo"] as? [[String: Any]]
|
|
36
|
-
return geoAreasDicts != nil
|
|
37
|
-
}
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
extension MMInbox {
|
|
@@ -80,24 +75,6 @@ extension MMBaseMessage {
|
|
|
80
75
|
}
|
|
81
76
|
}
|
|
82
77
|
|
|
83
|
-
extension MMRegion {
|
|
84
|
-
func dictionary() -> [String: Any] {
|
|
85
|
-
var areaCenter = [String: Any]()
|
|
86
|
-
areaCenter["lat"] = center.latitude
|
|
87
|
-
areaCenter["lon"] = center.longitude
|
|
88
|
-
|
|
89
|
-
var area = [String: Any]()
|
|
90
|
-
area["id"] = identifier
|
|
91
|
-
area["center"] = areaCenter
|
|
92
|
-
area["radius"] = radius
|
|
93
|
-
area["title"] = title
|
|
94
|
-
|
|
95
|
-
var result = [String: Any]()
|
|
96
|
-
result["area"] = area
|
|
97
|
-
return result
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
78
|
extension Optional {
|
|
102
79
|
func unwrap<T>(orDefault fallbackValue: T) -> T {
|
|
103
80
|
switch self {
|
|
@@ -116,7 +93,6 @@ struct EventName {
|
|
|
116
93
|
static let userUpdated = "userUpdated"
|
|
117
94
|
static let personalized = "personalized"
|
|
118
95
|
static let depersonalized = "depersonalized"
|
|
119
|
-
static let geofenceEntered = "geofenceEntered"
|
|
120
96
|
static let actionTapped = "actionTapped"
|
|
121
97
|
static let notificationTapped = "notificationTapped"
|
|
122
98
|
static let messageReceived = "messageReceived"
|
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": "12.
|
|
4
|
+
"version": "12.3.0",
|
|
5
5
|
"description": "Infobip Mobile Messaging React Native Plugin",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"scripts": {
|
package/src/index.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ declare namespace MobileMessagingReactNative {
|
|
|
7
7
|
'notificationTapped' |
|
|
8
8
|
'tokenReceived' |
|
|
9
9
|
'registrationUpdated' |
|
|
10
|
-
'geofenceEntered' |
|
|
11
10
|
'actionTapped' |
|
|
12
11
|
'installationUpdated' |
|
|
13
12
|
'userUpdated' |
|
|
@@ -26,7 +25,6 @@ declare namespace MobileMessagingReactNative {
|
|
|
26
25
|
webRTCUI?: {
|
|
27
26
|
configurationId: string;
|
|
28
27
|
} | undefined;
|
|
29
|
-
geofencingEnabled?: boolean | undefined;
|
|
30
28
|
inAppChatEnabled?: boolean | undefined;
|
|
31
29
|
fullFeaturedInAppsEnabled?: boolean | undefined;
|
|
32
30
|
/**
|
|
@@ -94,7 +92,6 @@ declare namespace MobileMessagingReactNative {
|
|
|
94
92
|
isPrimaryDevice?: boolean | undefined;
|
|
95
93
|
isPushRegistrationEnabled?: boolean | undefined;
|
|
96
94
|
notificationsEnabled?: boolean | undefined;
|
|
97
|
-
geoEnabled?: boolean | undefined;
|
|
98
95
|
sdkVersion?: string | undefined;
|
|
99
96
|
appVersion?: string | undefined;
|
|
100
97
|
os?: OS | undefined;
|
|
@@ -134,22 +131,6 @@ declare namespace MobileMessagingReactNative {
|
|
|
134
131
|
forceDepersonalize?: boolean | undefined;
|
|
135
132
|
}
|
|
136
133
|
|
|
137
|
-
export interface GeoData {
|
|
138
|
-
area: GeoArea;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export interface GeoArea {
|
|
142
|
-
id: string;
|
|
143
|
-
center: GeoCenter;
|
|
144
|
-
radius: number;
|
|
145
|
-
title: string;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export interface GeoCenter {
|
|
149
|
-
lat: number;
|
|
150
|
-
lon: number;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
134
|
export interface Message {
|
|
154
135
|
messageId: string;
|
|
155
136
|
title?: string | undefined;
|
|
@@ -162,7 +143,6 @@ declare namespace MobileMessagingReactNative {
|
|
|
162
143
|
seenDate?: number | undefined;
|
|
163
144
|
contentUrl?: string | undefined;
|
|
164
145
|
seen?: boolean | undefined;
|
|
165
|
-
geo?: boolean | undefined;
|
|
166
146
|
originalPayload?: Record<string, string> | undefined; // iOS only
|
|
167
147
|
vibrate?: boolean | undefined; // Android only
|
|
168
148
|
icon?: string | undefined; // Android only
|
|
@@ -360,7 +340,6 @@ declare namespace MobileMessagingReactNative {
|
|
|
360
340
|
"notificationTapped",
|
|
361
341
|
"tokenReceived",
|
|
362
342
|
"registrationUpdated",
|
|
363
|
-
"geofenceEntered",
|
|
364
343
|
"actionTapped",
|
|
365
344
|
"installationUpdated",
|
|
366
345
|
"userUpdated",
|
|
@@ -679,15 +658,6 @@ declare namespace MobileMessagingReactNative {
|
|
|
679
658
|
*/
|
|
680
659
|
setJwtProvider(jwtProvider: () => string): void;
|
|
681
660
|
|
|
682
|
-
/**
|
|
683
|
-
* This is used for requesting Location permissions for Android
|
|
684
|
-
* @param rationale rationale to display if it's needed. Describing why this permissions required.
|
|
685
|
-
* Mobile Messaging SDK requires following permissions to be able to send geo targeted notifications, even if application is killed or on background.
|
|
686
|
-
* ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION
|
|
687
|
-
* @return
|
|
688
|
-
*/
|
|
689
|
-
requestAndroidLocationPermissions(rationale ?: Rationale): Promise<boolean>;
|
|
690
|
-
|
|
691
661
|
/**
|
|
692
662
|
* Registering for POST_NOTIFICATIONS permission for Android 13+
|
|
693
663
|
*/
|
package/src/index.js
CHANGED
|
@@ -2,11 +2,8 @@ import {
|
|
|
2
2
|
EmitterSubscription,
|
|
3
3
|
NativeEventEmitter,
|
|
4
4
|
NativeModules,
|
|
5
|
-
Permission,
|
|
6
|
-
PermissionsAndroid,
|
|
7
5
|
Platform,
|
|
8
6
|
} from 'react-native';
|
|
9
|
-
import type {Rationale} from 'react-native/Libraries/PermissionsAndroid/PermissionsAndroid';
|
|
10
7
|
|
|
11
8
|
|
|
12
9
|
const { ReactNativeMobileMessaging, RNMMChat, RNMMWebRTCUI } = NativeModules;
|
|
@@ -23,7 +20,6 @@ class MobileMessaging {
|
|
|
23
20
|
"notificationTapped",
|
|
24
21
|
"tokenReceived",
|
|
25
22
|
"registrationUpdated",
|
|
26
|
-
"geofenceEntered",
|
|
27
23
|
"actionTapped",
|
|
28
24
|
"installationUpdated",
|
|
29
25
|
"userUpdated",
|
|
@@ -55,7 +51,6 @@ class MobileMessaging {
|
|
|
55
51
|
* - notificationTapped
|
|
56
52
|
* - tokenReceived
|
|
57
53
|
* - registrationUpdated
|
|
58
|
-
* - geofenceEntered
|
|
59
54
|
* - actionTapped
|
|
60
55
|
* - installationUpdated
|
|
61
56
|
* - userUpdated
|
|
@@ -91,7 +86,6 @@ class MobileMessaging {
|
|
|
91
86
|
* - notificationTapped
|
|
92
87
|
* - tokenReceived
|
|
93
88
|
* - registrationUpdated
|
|
94
|
-
* - geofenceEntered
|
|
95
89
|
* - actionTapped
|
|
96
90
|
* - installationUpdated
|
|
97
91
|
* - userUpdated
|
|
@@ -143,7 +137,6 @@ class MobileMessaging {
|
|
|
143
137
|
* webRTCUI: {
|
|
144
138
|
* configurationId: <String>
|
|
145
139
|
* },
|
|
146
|
-
* geofencingEnabled: true,
|
|
147
140
|
* messageStorage: '<Message storage save callback>',
|
|
148
141
|
* defaultMessageStorage: true,
|
|
149
142
|
* fullFeaturedInAppsEnabled: true,
|
|
@@ -353,7 +346,6 @@ class MobileMessaging {
|
|
|
353
346
|
* isPrimaryDevice: true,
|
|
354
347
|
* isPushRegistrationEnabled: true,
|
|
355
348
|
* notificationsEnabled: true,
|
|
356
|
-
* geoEnabled: false,
|
|
357
349
|
* sdkVersion: "1.2.3",
|
|
358
350
|
* appVersion: "2.3.4"
|
|
359
351
|
* os: "iOS",
|
|
@@ -707,63 +699,6 @@ class MobileMessaging {
|
|
|
707
699
|
ReactNativeMobileMessaging.registerForAndroidRemoteNotifications();
|
|
708
700
|
};
|
|
709
701
|
|
|
710
|
-
/* Geofencing permissions */
|
|
711
|
-
|
|
712
|
-
/**
|
|
713
|
-
* This is used for requesting Location permissions for Android
|
|
714
|
-
* @param rationale rationale to display if it's needed. Describing why this permissions required.
|
|
715
|
-
* Mobile Messaging SDK requires following permissions to be able to send geo targeted notifications, even if application is killed or on background.
|
|
716
|
-
* ACCESS_FINE_LOCATION, ACCESS_COARSE_LOCATION, ACCESS_BACKGROUND_LOCATION
|
|
717
|
-
* @return {Promise<boolean>}
|
|
718
|
-
*/
|
|
719
|
-
async requestAndroidLocationPermissions(rationale?: Rationale): Promise<Boolean> {
|
|
720
|
-
const requiredPermissions = await this.requiredAndroidLocationPermissions();
|
|
721
|
-
if (requiredPermissions.length === 0) {
|
|
722
|
-
return Promise.resolve(true);
|
|
723
|
-
}
|
|
724
|
-
|
|
725
|
-
return this.checkAndroidLocationPermission(requiredPermissions, rationale).then(granted => {
|
|
726
|
-
if (!granted) {
|
|
727
|
-
return Promise.resolve(false);
|
|
728
|
-
} else {
|
|
729
|
-
return this.requestAndroidLocationPermissions(rationale);
|
|
730
|
-
}
|
|
731
|
-
});
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
async checkAndroidLocationPermission(permissions: Array<Permission>, rationale?: Rationale): Promise<Boolean> {
|
|
735
|
-
for (permission of permissions) {
|
|
736
|
-
const granted = await PermissionsAndroid.request(permission, rationale);
|
|
737
|
-
if (granted !== PermissionsAndroid.RESULTS.GRANTED) {
|
|
738
|
-
console.log("Permissions Result != Granted ", permission, granted);
|
|
739
|
-
return Promise.resolve(false);
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
console.log("Permissions Result == Granted ");
|
|
743
|
-
return Promise.resolve(true);
|
|
744
|
-
};
|
|
745
|
-
|
|
746
|
-
async requiredAndroidLocationPermissions(): Promise<Array<Permission>> {
|
|
747
|
-
let permissions: Array<Permission> = [];
|
|
748
|
-
const fineLocationGranted = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION);
|
|
749
|
-
if (!fineLocationGranted) {
|
|
750
|
-
if (Platform.Version > 29) {
|
|
751
|
-
permissions = [PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION];
|
|
752
|
-
} else if (Platform.Version === 29) {
|
|
753
|
-
permissions = [PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION, PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION];
|
|
754
|
-
} else {
|
|
755
|
-
permissions = [PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION];
|
|
756
|
-
}
|
|
757
|
-
} else {
|
|
758
|
-
const backgroundLocationGranted = await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION);
|
|
759
|
-
if (!backgroundLocationGranted && Platform.Version > 29) {
|
|
760
|
-
permissions = [PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION];
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
return Promise.resolve(permissions);
|
|
765
|
-
};
|
|
766
|
-
|
|
767
702
|
/**
|
|
768
703
|
* This method is iOS only and it has no effect in Android.
|
|
769
704
|
* Used to reset the In-app chat connection. The correct usage is to call it after stopConnection, when we want the messages to reappear, and push
|
|
Binary file
|