infobip-mobile-messaging-react-native-plugin 6.2.1 → 6.2.2
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 -0
- package/index.d.ts +7 -0
- package/index.js +9 -0
- package/infobip-mobile-messaging-react-native-plugin-6.2.1.tgz +0 -0
- package/ios/MobileMessagingPlugin/RNMMChat.swift +5 -0
- package/ios/MobileMessagingPlugin/RNMMChatBridge.m +1 -0
- package/ios/MobileMessagingPlugin/RNMobileMessaging.swift +21 -6
- package/ios/MobileMessagingPlugin/RNMobileMessagingEventsManager.swift +1 -1
- package/package.json +1 -1
- package/infobip-mobile-messaging-react-native-plugin-6.2.0.tgz +0 -0
package/android/build.gradle
CHANGED
|
@@ -50,6 +50,10 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
|
|
|
50
50
|
InAppChat.getInstance(reactContext).resetMessageCounter();
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
@ReactMethod
|
|
54
|
+
public void setLanguage(String localeString){
|
|
55
|
+
InAppChat.getInstance(reactContext).setLanguage(localeString);
|
|
56
|
+
}
|
|
53
57
|
@Override
|
|
54
58
|
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
|
|
55
59
|
FragmentActivity fragmentActivity = Utils.getFragmentActivity(reactContext);
|
package/index.d.ts
CHANGED
|
@@ -460,6 +460,13 @@ declare namespace MobileMessagingReactNative {
|
|
|
460
460
|
*/
|
|
461
461
|
setupiOSChatSettings(settings: ChatSettingsIOS): void;
|
|
462
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Set chat language
|
|
465
|
+
*
|
|
466
|
+
* @param localeString
|
|
467
|
+
*/
|
|
468
|
+
setLanguage(localeString: string): void;
|
|
469
|
+
|
|
463
470
|
/**
|
|
464
471
|
* Returns unread in-app chat push messages counter.
|
|
465
472
|
* The counter increments each time the application receives in-app chat push message
|
package/index.js
CHANGED
|
@@ -546,6 +546,15 @@ class MobileMessaging {
|
|
|
546
546
|
}
|
|
547
547
|
};
|
|
548
548
|
|
|
549
|
+
/**
|
|
550
|
+
* The predefined messages prompted within the In-app chat (such as status updates, button titles, input field prompt) by default are
|
|
551
|
+
* localized using system locale setting, but can be easily changed providing your locale string with the following formats:
|
|
552
|
+
* "es_ES", "es-ES" or "es"
|
|
553
|
+
*/
|
|
554
|
+
setLanguage(localeString) {
|
|
555
|
+
RNMMChat.setLanguage(localeString);
|
|
556
|
+
};
|
|
557
|
+
|
|
549
558
|
/**
|
|
550
559
|
* Returns unread in-app chat push messages counter.
|
|
551
560
|
* The counter increments each time the application receives in-app chat push message
|
|
Binary file
|
|
@@ -20,6 +20,7 @@ RCT_EXTERN_METHOD(showChat:)
|
|
|
20
20
|
RCT_EXTERN_METHOD(getMessageCounter:(RCTResponseSenderBlock)resultCallback)
|
|
21
21
|
RCT_EXTERN_METHOD(resetMessageCounter)
|
|
22
22
|
RCT_EXTERN_METHOD(setupChatSettings:)
|
|
23
|
+
RCT_EXTERN_METHOD(setLanguage:)
|
|
23
24
|
|
|
24
25
|
- (dispatch_queue_t)methodQueue {
|
|
25
26
|
return dispatch_get_main_queue();
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
import Foundation
|
|
9
9
|
import MobileMessaging
|
|
10
10
|
|
|
11
|
+
// It may happen that RN call module initialization more than once,
|
|
12
|
+
// Not needed to perform early start more than once per application session.
|
|
13
|
+
var isEarlyStartPerformed = false;
|
|
14
|
+
|
|
11
15
|
@objc(ReactNativeMobileMessaging)
|
|
12
16
|
class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
13
17
|
private var messageStorageAdapter: MessageStorageAdapter?
|
|
@@ -47,6 +51,13 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
|
47
51
|
super.stopObserving()
|
|
48
52
|
}
|
|
49
53
|
|
|
54
|
+
override func sendEvent(withName name: String!, body: Any!) {
|
|
55
|
+
guard let _eventsManager = eventsManager, _eventsManager.hasEventListeners == true else {
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
super.sendEvent(withName: name, body: body)
|
|
59
|
+
}
|
|
60
|
+
|
|
50
61
|
@objc
|
|
51
62
|
override static func requiresMainQueueSetup() -> Bool {
|
|
52
63
|
return true
|
|
@@ -79,8 +90,9 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
|
79
90
|
let cachedConfigDict = RNMobileMessagingConfiguration.getRawConfigFromDefaults()
|
|
80
91
|
if let cachedConfigDict = cachedConfigDict, (config as NSDictionary) != (cachedConfigDict as NSDictionary)
|
|
81
92
|
{
|
|
82
|
-
stop
|
|
83
|
-
|
|
93
|
+
stop {
|
|
94
|
+
self.start(configuration: configuration, onSuccess: successCallback)
|
|
95
|
+
}
|
|
84
96
|
} else if cachedConfigDict == nil {
|
|
85
97
|
start(configuration: configuration, onSuccess: successCallback)
|
|
86
98
|
} else {
|
|
@@ -91,9 +103,12 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
|
91
103
|
private func performEarlyStartIfPossible() {
|
|
92
104
|
if let cachedConfigDict = RNMobileMessagingConfiguration.getRawConfigFromDefaults(),
|
|
93
105
|
let configuration = RNMobileMessagingConfiguration(rawConfig: cachedConfigDict),
|
|
94
|
-
!self.isStarted
|
|
106
|
+
!self.isStarted,
|
|
107
|
+
!isEarlyStartPerformed
|
|
95
108
|
{
|
|
96
|
-
|
|
109
|
+
MMLogDebug("[RNMobileMessaging] Performing early start")
|
|
110
|
+
isEarlyStartPerformed = true
|
|
111
|
+
start(configuration: configuration) { response in }
|
|
97
112
|
}
|
|
98
113
|
}
|
|
99
114
|
|
|
@@ -134,9 +149,9 @@ class ReactNativeMobileMessaging: RCTEventEmitter {
|
|
|
134
149
|
})
|
|
135
150
|
}
|
|
136
151
|
|
|
137
|
-
private func stop() {
|
|
138
|
-
MobileMessaging.stop()
|
|
152
|
+
private func stop(completion: @escaping () -> Void) {
|
|
139
153
|
eventsManager?.stop()
|
|
154
|
+
MobileMessaging.stop(false, completion: completion)
|
|
140
155
|
}
|
|
141
156
|
|
|
142
157
|
/*User Profile Management*/
|
|
@@ -10,7 +10,7 @@ import MobileMessaging
|
|
|
10
10
|
|
|
11
11
|
class RNMobileMessagingEventsManager {
|
|
12
12
|
private var eventEmitter: RCTEventEmitter!
|
|
13
|
-
|
|
13
|
+
public var hasEventListeners = false
|
|
14
14
|
private var cachedMobileMessagingNotifications = [Notification]()
|
|
15
15
|
|
|
16
16
|
private let supportedNotifications: [String: String] = [
|
package/package.json
CHANGED
|
Binary file
|