infobip-mobile-messaging-react-native-plugin 6.3.5 → 6.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/android/build.gradle +1 -1
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/RNMMChatModule.java +12 -1
- package/index.d.ts +10 -0
- package/index.js +12 -0
- package/infobip-mobile-messaging-react-native-plugin-6.3.6.tgz +0 -0
- package/infobip-mobile-messaging-react-native-plugin.podspec +3 -3
- package/ios/Cartfile +1 -1
- package/ios/Cartfile.resolved +1 -1
- package/ios/MobileMessagingPlugin/RNMMChat.swift +14 -0
- package/ios/MobileMessagingPlugin/RNMMChatBridge.m +1 -0
- package/ios/MobileMessagingPlugin/RNMobileMessagingUtils.swift +17 -0
- package/package.json +1 -1
- package/infobip-mobile-messaging-react-native-plugin-6.3.4.tgz +0 -0
package/android/build.gradle
CHANGED
|
@@ -51,9 +51,20 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
@ReactMethod
|
|
54
|
-
public void setLanguage(String localeString){
|
|
54
|
+
public void setLanguage(String localeString) {
|
|
55
55
|
InAppChat.getInstance(reactContext).setLanguage(localeString);
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
@ReactMethod
|
|
59
|
+
public void sendContextualData(String data, Boolean allMultiThreadStrategy, Callback onSuccess, Callback onError) {
|
|
60
|
+
try {
|
|
61
|
+
InAppChat.getInstance(reactContext).sendContextualData(data, allMultiThreadStrategy);
|
|
62
|
+
onSuccess.invoke();
|
|
63
|
+
} catch (Throwable t) {
|
|
64
|
+
onError.invoke(Utils.callbackError(t.getMessage(), null));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
57
68
|
@Override
|
|
58
69
|
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
|
|
59
70
|
FragmentActivity fragmentActivity = Utils.getFragmentActivity(reactContext);
|
package/index.d.ts
CHANGED
|
@@ -460,6 +460,16 @@ declare namespace MobileMessagingReactNative {
|
|
|
460
460
|
*/
|
|
461
461
|
setupiOSChatSettings(settings: ChatSettingsIOS): void;
|
|
462
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Set contextual data of the widget
|
|
465
|
+
*
|
|
466
|
+
* @param data contextual data in the form of JSON string
|
|
467
|
+
* @param allMultiThreadStrategy multi-thread strategy flag, true -> ALL, false -> ACTIVE
|
|
468
|
+
* @param {Function} onSuccess. Success callback
|
|
469
|
+
* @param {Function} onError. Error callback
|
|
470
|
+
*/
|
|
471
|
+
sendContextualData(data: string, allMultiThreadStrategy: boolean, onSuccess = () => void, onError = (error: string) => void): void;
|
|
472
|
+
|
|
463
473
|
/**
|
|
464
474
|
* Set chat language
|
|
465
475
|
*
|
package/index.js
CHANGED
|
@@ -555,6 +555,18 @@ class MobileMessaging {
|
|
|
555
555
|
RNMMChat.setLanguage(localeString);
|
|
556
556
|
};
|
|
557
557
|
|
|
558
|
+
/**
|
|
559
|
+
* Set contextual data of the widget
|
|
560
|
+
*
|
|
561
|
+
* @param data - contextual data in the form of JSON string
|
|
562
|
+
* @param allMultiThreadStrategy - multi-thread strategy flag, true -> ALL, false -> ACTIVE
|
|
563
|
+
* @param {Function} onSuccess. Success callback
|
|
564
|
+
* @param {Function} onError. Error callback
|
|
565
|
+
*/
|
|
566
|
+
sendContextualData(data, allMultiThreadStrategy = false, onSuccess = function() {}, onError = function() {}) {
|
|
567
|
+
RNMMChat.sendContextualData(data, allMultiThreadStrategy, onSuccess, onError);
|
|
568
|
+
};
|
|
569
|
+
|
|
558
570
|
/**
|
|
559
571
|
* Returns unread in-app chat push messages counter.
|
|
560
572
|
* The counter increments each time the application receives in-app chat push message
|
|
Binary file
|
|
@@ -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.
|
|
23
|
-
s.dependency "MobileMessaging/Geofencing", "10.
|
|
24
|
-
s.dependency "MobileMessaging/InAppChat", "10.
|
|
22
|
+
s.dependency "MobileMessaging/Core", "10.4.1"
|
|
23
|
+
s.dependency "MobileMessaging/Geofencing", "10.4.1"
|
|
24
|
+
s.dependency "MobileMessaging/InAppChat", "10.4.1"
|
|
25
25
|
|
|
26
26
|
end
|
package/ios/Cartfile
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
github "infobip/mobile-messaging-sdk-ios" "10.
|
|
1
|
+
github "infobip/mobile-messaging-sdk-ios" "10.4.1"
|
package/ios/Cartfile.resolved
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
github "infobip/mobile-messaging-sdk-ios" "10.
|
|
1
|
+
github "infobip/mobile-messaging-sdk-ios" "10.4.1"
|
|
@@ -51,4 +51,18 @@ class RNMMChat: NSObject {
|
|
|
51
51
|
func setLanguage(localeString: String) {
|
|
52
52
|
MobileMessaging.inAppChat?.setLanguage(localeString)
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
@objc(sendContextualData:multiThreadStrategy:onSuccess:onError:)
|
|
56
|
+
func sendContextualData(data: NSString, multiThreadStrategy: Bool, onSuccess: @escaping RCTResponseSenderBlock, onError: @escaping RCTResponseSenderBlock) {
|
|
57
|
+
guard let chatVC = UIApplication.topViewController() as? MMChatViewController else {
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
chatVC.sendContextualData(String(data), multiThreadStrategy: multiThreadStrategy ? .ALL : .ACTIVE) { error in
|
|
61
|
+
if let error = error {
|
|
62
|
+
onError([error.reactNativeObject])
|
|
63
|
+
} else {
|
|
64
|
+
onSuccess(nil)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
54
68
|
}
|
|
@@ -21,6 +21,7 @@ RCT_EXTERN_METHOD(getMessageCounter:(RCTResponseSenderBlock)resultCallback)
|
|
|
21
21
|
RCT_EXTERN_METHOD(resetMessageCounter)
|
|
22
22
|
RCT_EXTERN_METHOD(setupChatSettings:)
|
|
23
23
|
RCT_EXTERN_METHOD(setLanguage:)
|
|
24
|
+
RCT_EXTERN_METHOD(sendContextualData:(NSString *)data multiThreadStrategy:(BOOL)multiThreadStrategy onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
24
25
|
|
|
25
26
|
- (dispatch_queue_t)methodQueue {
|
|
26
27
|
return dispatch_get_main_queue();
|
|
@@ -118,3 +118,20 @@ struct EventName {
|
|
|
118
118
|
static let inAppChat_availabilityUpdated = "inAppChat.availabilityUpdated"
|
|
119
119
|
static let inAppChat_unreadMessageCounterUpdated = "inAppChat.unreadMessageCounterUpdated"
|
|
120
120
|
}
|
|
121
|
+
|
|
122
|
+
extension UIApplication {
|
|
123
|
+
class func topViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
|
|
124
|
+
if let navigationController = controller as? UINavigationController {
|
|
125
|
+
return topViewController(controller: navigationController.visibleViewController)
|
|
126
|
+
}
|
|
127
|
+
if let tabController = controller as? UITabBarController {
|
|
128
|
+
if let selected = tabController.selectedViewController {
|
|
129
|
+
return topViewController(controller: selected)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if let presented = controller?.presentedViewController {
|
|
133
|
+
return topViewController(controller: presented)
|
|
134
|
+
}
|
|
135
|
+
return controller
|
|
136
|
+
}
|
|
137
|
+
}
|
package/package.json
CHANGED
|
Binary file
|