infobip-mobile-messaging-react-native-plugin 12.5.6 → 12.6.0-rc
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 +1 -1
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/RNMMChatModule.java +4 -2
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/ReactNativeMobileMessagingModule.java +13 -0
- package/infobip-mobile-messaging-react-native-plugin-12.6.0.tgz +0 -0
- package/infobip-mobile-messaging-react-native-plugin.podspec +4 -4
- package/ios/MobileMessagingPlugin/RNMMChat.swift +24 -13
- package/ios/MobileMessagingPlugin/RNMMChatBridge.m +1 -0
- package/ios/MobileMessagingPlugin/RNMobileMessaging.swift +8 -0
- package/ios/MobileMessagingPlugin/RNMobileMessagingBridge.m +1 -0
- package/package.json +1 -1
- package/release.sh +1 -1
- package/src/index.d.ts +29 -0
- package/src/index.js +33 -1
- package/infobip-mobile-messaging-react-native-plugin-12.5.5.tgz +0 -0
- package/infobip-mobile-messaging-react-native-plugin.tgz +0 -0
package/android/build.gradle
CHANGED
|
@@ -33,6 +33,7 @@ import org.infobip.mobile.messaging.mobileapi.Result;
|
|
|
33
33
|
import org.infobip.mobile.messaging.util.StringUtils;
|
|
34
34
|
import org.infobip.reactlibrary.mobilemessaging.datamappers.ReactNativeJson;
|
|
35
35
|
import org.infobip.mobile.messaging.api.support.http.serialization.JsonSerializer;
|
|
36
|
+
import org.infobip.mobile.messaging.chat.core.MultithreadStrategy;
|
|
36
37
|
import org.json.JSONException;
|
|
37
38
|
import org.json.JSONObject;
|
|
38
39
|
|
|
@@ -120,9 +121,10 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
@ReactMethod
|
|
123
|
-
public void sendContextualData(String data,
|
|
124
|
+
public void sendContextualData(String data, String multithreadStrategyFlag, Callback onSuccess, Callback onError) {
|
|
124
125
|
try {
|
|
125
|
-
|
|
126
|
+
MultithreadStrategy multithreadStrategy = MultithreadStrategy.valueOf(multithreadStrategyFlag);
|
|
127
|
+
InAppChat.getInstance(reactContext).sendContextualData(data, multithreadStrategy);
|
|
126
128
|
onSuccess.invoke();
|
|
127
129
|
} catch (Throwable t) {
|
|
128
130
|
onError.invoke(Utils.callbackError(t.getMessage(), null));
|
|
@@ -793,6 +793,19 @@ public class ReactNativeMobileMessagingModule extends ReactContextBaseJavaModule
|
|
|
793
793
|
});
|
|
794
794
|
}
|
|
795
795
|
|
|
796
|
+
@ReactMethod
|
|
797
|
+
public void cleanup(final Callback successCallback, final Callback errorCallback) {
|
|
798
|
+
try {
|
|
799
|
+
MobileMessaging mm = MobileMessaging.getInstance(reactContext.getApplicationContext());
|
|
800
|
+
if (mm != null) {
|
|
801
|
+
mm.cleanup();
|
|
802
|
+
}
|
|
803
|
+
successCallback.invoke("success");
|
|
804
|
+
} catch (Throwable t) {
|
|
805
|
+
errorCallback.invoke(Utils.callbackError(t.getMessage(), null));
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
|
|
796
809
|
@ReactMethod
|
|
797
810
|
public void depersonalizeInstallation(final String pushRegistrationId, final Callback successCallback, final Callback errorCallback) {
|
|
798
811
|
if (pushRegistrationId.isEmpty()) {
|
|
Binary file
|
|
@@ -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.
|
|
23
|
-
s.dependency "MobileMessaging/InAppChat", "12.
|
|
24
|
-
s.dependency "MobileMessaging/Inbox", "12.
|
|
22
|
+
s.dependency "MobileMessaging/Core", "12.17.0"
|
|
23
|
+
s.dependency "MobileMessaging/InAppChat", "12.17.0"
|
|
24
|
+
s.dependency "MobileMessaging/Inbox", "12.17.0"
|
|
25
25
|
if defined?($WebRTCUIEnabled)
|
|
26
|
-
s.dependency "MobileMessaging/WebRTCUI", "12.
|
|
26
|
+
s.dependency "MobileMessaging/WebRTCUI", "12.17.0"
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -159,20 +159,31 @@ class RNMMChat: NSObject {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
@objc(sendContextualData:
|
|
163
|
-
func sendContextualData(data: NSString,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
} else if let inAppChat = MobileMessaging.inAppChat {
|
|
173
|
-
inAppChat.sendContextualData(String(data), multiThreadStrategy: multiThreadStrategy ? .ALL : .ACTIVE)
|
|
174
|
-
onSuccess(nil)
|
|
162
|
+
@objc(sendContextualData:chatMultiThreadStrategy:onSuccess:onError:)
|
|
163
|
+
func sendContextualData(data: NSString, chatMultiThreadStrategy: NSString, onSuccess: @escaping RCTResponseSenderBlock, onError: @escaping RCTResponseSenderBlock) {
|
|
164
|
+
var strategy: MMChatMultiThreadStrategy
|
|
165
|
+
switch chatMultiThreadStrategy {
|
|
166
|
+
case "ACTIVE": strategy = .ACTIVE
|
|
167
|
+
case "ALL": strategy = .ALL
|
|
168
|
+
case "ALL_PLUS_NEW": strategy = .ALL_PLUS_NEW
|
|
169
|
+
default:
|
|
170
|
+
onError([NSError(type: .InvalidArguments)])
|
|
171
|
+
return
|
|
175
172
|
}
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
if let chatVC = RNMMChatView.viewController {
|
|
176
|
+
chatVC.sendContextualData(String(data), multiThreadStrategy: strategy) { error in
|
|
177
|
+
if let error = error {
|
|
178
|
+
onError([error.reactNativeObject])
|
|
179
|
+
} else {
|
|
180
|
+
onSuccess(nil)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
} else if let inAppChat = MobileMessaging.inAppChat {
|
|
184
|
+
inAppChat.sendContextualData(String(data), multiThreadStrategy: strategy)
|
|
185
|
+
onSuccess(nil)
|
|
186
|
+
}
|
|
176
187
|
}
|
|
177
188
|
|
|
178
189
|
@objc(setJwt:)
|
|
@@ -24,6 +24,7 @@ RCT_EXTERN_METHOD(setupChatSettings:)
|
|
|
24
24
|
RCT_EXTERN_METHOD(setLanguage:(NSString *)data onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
25
25
|
RCT_EXTERN_METHOD(setJwt:)
|
|
26
26
|
RCT_EXTERN_METHOD(sendContextualData:(NSString *)data multiThreadStrategy:(BOOL)multiThreadStrategy onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
27
|
+
RCT_EXTERN_METHOD(sendContextualData:(NSString *)data chatMultiThreadStrategy:(NSString *)chatMultiThreadStrategy onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
27
28
|
RCT_EXTERN_METHOD(showThreadsList)
|
|
28
29
|
RCT_EXTERN_METHOD(restartConnection)
|
|
29
30
|
RCT_EXTERN_METHOD(stopConnection)
|
|
@@ -318,6 +318,14 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
|
318
318
|
})
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
+
@objc(cleanup:onError:)
|
|
322
|
+
func cleanup(onSuccess: @escaping RCTResponseSenderBlock, onError: @escaping RCTResponseSenderBlock) {
|
|
323
|
+
UserDefaults.standard.removeObject(forKey: RNMobileMessagingConfiguration.userDefaultsConfigKey)
|
|
324
|
+
MobileMessaging.cleanUpAndStop(true, completion: {
|
|
325
|
+
onSuccess(["success"])
|
|
326
|
+
})
|
|
327
|
+
}
|
|
328
|
+
|
|
321
329
|
@objc(depersonalizeInstallation:onSuccess:onError:)
|
|
322
330
|
func depersonalizeInstallation(pushRegistrationId: NSString, onSuccess: @escaping RCTResponseSenderBlock, onError: @escaping RCTResponseSenderBlock) {
|
|
323
331
|
MobileMessaging.depersonalizeInstallation(withPushRegistrationId: pushRegistrationId as String, completion: { (installations, error) in
|
|
@@ -30,6 +30,7 @@ RCT_EXTERN_METHOD(getInstallation:(RCTResponseSenderBlock)successCallback)
|
|
|
30
30
|
RCT_EXTERN_METHOD(setInstallationAsPrimary:(NSString *)pushRegistrationId primary:(BOOL)primary onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
31
31
|
RCT_EXTERN_METHOD(personalize:(NSDictionary *)context onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
32
32
|
RCT_EXTERN_METHOD(depersonalize:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
33
|
+
RCT_EXTERN_METHOD(cleanup:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
33
34
|
RCT_EXTERN_METHOD(depersonalizeInstallation:(NSString *)pushRegistrationId onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
34
35
|
|
|
35
36
|
/*Messages and Notifications*/
|
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.6.0-rc",
|
|
5
5
|
"description": "Infobip Mobile Messaging React Native Plugin",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"scripts": {
|
package/release.sh
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -325,6 +325,12 @@ declare namespace MobileMessagingReactNative {
|
|
|
325
325
|
inputTextAppearance: string;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
export enum ChatMultithreadStrategy {
|
|
329
|
+
active = "ACTIVE",
|
|
330
|
+
all = "ALL",
|
|
331
|
+
allPlusNew = "ALL_PLUS_NEW"
|
|
332
|
+
}
|
|
333
|
+
|
|
328
334
|
interface Api {
|
|
329
335
|
|
|
330
336
|
inAppChatEvents: [
|
|
@@ -536,6 +542,15 @@ declare namespace MobileMessagingReactNative {
|
|
|
536
542
|
*/
|
|
537
543
|
depersonalize(callback: (personalizeContext: PersonalizeContext) => void, errorCallback: (error: MobileMessagingError) => void): void;
|
|
538
544
|
|
|
545
|
+
/**
|
|
546
|
+
* Erases all locally stored SDK data and stops SDK services. After cleanup
|
|
547
|
+
* the plugin can be re-initialized with a different application code.
|
|
548
|
+
*
|
|
549
|
+
* @param callback will be called on success
|
|
550
|
+
* @param errorCallback will be called on error
|
|
551
|
+
*/
|
|
552
|
+
cleanup(callback: () => void, errorCallback: (error: MobileMessagingError) => void): void;
|
|
553
|
+
|
|
539
554
|
/**
|
|
540
555
|
* Performs depersonalization of the installation referenced by pushRegistrationId.
|
|
541
556
|
*
|
|
@@ -604,6 +619,7 @@ declare namespace MobileMessagingReactNative {
|
|
|
604
619
|
setWidgetTheme(widgetTheme: string): void;
|
|
605
620
|
|
|
606
621
|
/**
|
|
622
|
+
* @deprecated use sendContextualData with chatMultiThreadStrategy string param instead of allMultiThreadStrategy bool.
|
|
607
623
|
* Set contextual data of the Livechat Widget.
|
|
608
624
|
* If the function is called when the chat is loaded, data will be sent immediately, otherwise they will be sent to the chat once it is loaded.
|
|
609
625
|
* Every function invocation will overwrite the previous contextual data.
|
|
@@ -616,6 +632,19 @@ declare namespace MobileMessagingReactNative {
|
|
|
616
632
|
*/
|
|
617
633
|
sendContextualData(data: string, allMultiThreadStrategy: boolean, onSuccess: () => void, onError: (error: MobileMessagingError) => void): void;
|
|
618
634
|
|
|
635
|
+
/**
|
|
636
|
+
* Set contextual data of the Livechat Widget.
|
|
637
|
+
* If the function is called when the chat is loaded, data will be sent immediately, otherwise they will be sent to the chat once it is loaded.
|
|
638
|
+
* Every function invocation will overwrite the previous contextual data.
|
|
639
|
+
*
|
|
640
|
+
* @name sendContextualData
|
|
641
|
+
* @param data contextual data in the form of JSON string
|
|
642
|
+
* @param chatMultiThreadStrategy multi-thread strategy: 'ACTIVE', 'ALL', 'ALL_PLUS_NEW'
|
|
643
|
+
* @param {Function} onSuccess success callback
|
|
644
|
+
* @param {Function} onError error callback
|
|
645
|
+
*/
|
|
646
|
+
sendContextualData(data: string, chatMultiThreadStrategy: ChatMultithreadStrategy, onSuccess: () => void, onError: (error: MobileMessagingError) => void): void;
|
|
647
|
+
|
|
619
648
|
/**
|
|
620
649
|
* Set chat language
|
|
621
650
|
* @name setLanguage
|
package/src/index.js
CHANGED
|
@@ -441,6 +441,18 @@ class MobileMessaging {
|
|
|
441
441
|
ReactNativeMobileMessaging.depersonalize(onSuccess, onError);
|
|
442
442
|
};
|
|
443
443
|
|
|
444
|
+
/**
|
|
445
|
+
* Erases all locally stored SDK data and stops SDK services. After cleanup
|
|
446
|
+
* the plugin can be re-initialized with a different application code.
|
|
447
|
+
*
|
|
448
|
+
* @name cleanup
|
|
449
|
+
* @param {Function} onSuccess will be called on success
|
|
450
|
+
* @param {Function} onError will be called on error
|
|
451
|
+
*/
|
|
452
|
+
cleanup(onSuccess = function() {}, onError = function() {}) {
|
|
453
|
+
ReactNativeMobileMessaging.cleanup(onSuccess, onError);
|
|
454
|
+
};
|
|
455
|
+
|
|
444
456
|
/**
|
|
445
457
|
* Performs depersonalization of the installation referenced by pushRegistrationId.
|
|
446
458
|
*
|
|
@@ -615,6 +627,7 @@ class MobileMessaging {
|
|
|
615
627
|
};
|
|
616
628
|
|
|
617
629
|
/**
|
|
630
|
+
* @deprecated use sendContextualData with chatMultiThreadStrategy string param instead of allMultiThreadStrategy bool.
|
|
618
631
|
* Set contextual data of the Livechat Widget.
|
|
619
632
|
* If the function is called when the chat is loaded, data will be sent immediately, otherwise they will be sent to the chat once it is loaded.
|
|
620
633
|
* Every function invocation will overwrite the previous contextual data.
|
|
@@ -626,7 +639,26 @@ class MobileMessaging {
|
|
|
626
639
|
* @param {Function} onError error callback
|
|
627
640
|
*/
|
|
628
641
|
sendContextualData(data, allMultiThreadStrategy = false, onSuccess = function() {}, onError = function() {}) {
|
|
629
|
-
|
|
642
|
+
if (allMultiThreadStrategy) {
|
|
643
|
+
sendContextualData(data, 'ALL', onSuccess, onError)
|
|
644
|
+
} else {
|
|
645
|
+
sendContextualData(data, 'ACTIVE', onSuccess, onError)
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Set contextual data of the Livechat Widget.
|
|
651
|
+
* If the function is called when the chat is loaded, data will be sent immediately, otherwise they will be sent to the chat once it is loaded.
|
|
652
|
+
* Every function invocation will overwrite the previous contextual data.
|
|
653
|
+
*
|
|
654
|
+
* @name sendContextualData
|
|
655
|
+
* @param data - contextual data in the form of JSON string
|
|
656
|
+
* @param chatMultiThreadStrategy - multi-thread strategy flag: ACTIVE, ALL, ALL_PLUS_NEW
|
|
657
|
+
* @param {Function} onSuccess success callback
|
|
658
|
+
* @param {Function} onError error callback
|
|
659
|
+
*/
|
|
660
|
+
sendContextualData(data, chatMultiThreadStrategy = 'ACTIVE', onSuccess = function() {}, onError = function() {}) {
|
|
661
|
+
RNMMChat.sendContextualData(data, chatMultiThreadStrategy, onSuccess, onError);
|
|
630
662
|
};
|
|
631
663
|
|
|
632
664
|
/**
|
|
Binary file
|
|
Binary file
|