infobip-mobile-messaging-react-native-plugin 8.2.0 → 8.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.
@@ -86,7 +86,7 @@ repositories {
86
86
  }
87
87
 
88
88
  dependencies {
89
- def mmVersion = '8.2.0'
89
+ def mmVersion = '8.4.0'
90
90
 
91
91
  implementation 'com.facebook.react:react-native:+'
92
92
  implementation "androidx.annotation:annotation:1.1.0"
@@ -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", "10.19.0"
23
- s.dependency "MobileMessaging/Geofencing", "10.19.0"
24
- s.dependency "MobileMessaging/InAppChat", "10.19.0"
22
+ s.dependency "MobileMessaging/Core", "10.20.0"
23
+ s.dependency "MobileMessaging/Geofencing", "10.20.0"
24
+ s.dependency "MobileMessaging/InAppChat", "10.20.0"
25
25
  if defined?($WebRTCUIEnabled)
26
- s.dependency "MobileMessaging/WebRTCUI", "10.19.0"
26
+ s.dependency "MobileMessaging/WebRTCUI", "10.20.0"
27
27
  end
28
28
  end
@@ -90,4 +90,14 @@ class RNMMChat: NSObject {
90
90
  func setJwt(jwt: String) {
91
91
  MobileMessaging.inAppChat?.jwt = jwt
92
92
  }
93
+
94
+ @objc(restartConnection)
95
+ func restartConnection() {
96
+ RNMMChatView.viewController?.restartConnection()
97
+ }
98
+
99
+ @objc(stopConnection)
100
+ func stopConnection() {
101
+ RNMMChatView.viewController?.stopConnection()
102
+ }
93
103
  }
@@ -24,6 +24,8 @@ RCT_EXTERN_METHOD(setLanguage:(NSString *)data onSuccess:(RCTResponseSenderBlock
24
24
  RCT_EXTERN_METHOD(setJwt:)
25
25
  RCT_EXTERN_METHOD(sendContextualData:(NSString *)data multiThreadStrategy:(BOOL)multiThreadStrategy onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
26
26
  RCT_EXTERN_METHOD(showThreadsList)
27
+ RCT_EXTERN_METHOD(restartConnection)
28
+ RCT_EXTERN_METHOD(stopConnection)
27
29
 
28
30
  - (dispatch_queue_t)methodQueue {
29
31
  return dispatch_get_main_queue();
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": "8.2.0",
4
+ "version": "8.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
@@ -529,6 +529,24 @@ declare namespace MobileMessagingReactNative {
529
529
  * Registering for POST_NOTIFICATIONS permission for Android 13+
530
530
  */
531
531
  registerForAndroidRemoteNotifications(): void;
532
+
533
+ /**
534
+ * This method is iOS only and it has no effect in Android.
535
+ * 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
536
+ * notifications to stop.
537
+ * In Android In-app chat connection is automatically established and stopped based on component lifecycle. Chat connection is active only when Lifecycle.State is at least Lifecycle.State.STARTED. Chat connection is stopped when Lifecycle.State is below Lifecycle.State.STARTED.
538
+ * @name restartConnection
539
+ */
540
+ restartConnection(): void;
541
+
542
+ /**
543
+ * This method is iOS only and it has no effect in Android.
544
+ * Used to stop In-app chat connection. This has two effects: the chat message is cleared, and push notifications from incoming messages events
545
+ * start coming again to the device, even with the In-app chat in foreground. In order for the chat messages to reappear, simply call restartConnection.
546
+ * In Android In-app chat connection is automatically established and stopped based on component lifecycle. Chat connection is active only when Lifecycle.State is at least Lifecycle.State.STARTED. Chat connection is stopped when Lifecycle.State is below Lifecycle.State.STARTED.
547
+ * @name stopConnection
548
+ */
549
+ stopConnection(): void;
532
550
  }
533
551
  }
534
552
 
package/src/index.js CHANGED
@@ -696,6 +696,33 @@ class MobileMessaging {
696
696
  return Promise.resolve(permissions);
697
697
  };
698
698
 
699
+ /**
700
+ * This method is iOS only and it has no effect in Android.
701
+ * 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
702
+ * notifications to stop.
703
+ * In Android In-app chat connection is automatically established and stopped based on component lifecycle. Chat connection is active only when Lifecycle.State is at least Lifecycle.State.STARTED. Chat connection is stopped when Lifecycle.State is below Lifecycle.State.STARTED.
704
+ * @name restartConnection
705
+ */
706
+ restartConnection() {
707
+ if (Platform.OS === "android") {
708
+ return;
709
+ }
710
+ RNMMChat.restartConnection();
711
+ };
712
+
713
+ /**
714
+ * This method is iOS only and it has no effect in Android.
715
+ * Used to stop In-app chat connection. This has two effects: the chat message is cleared, and push notifications from incoming messages events
716
+ * start coming again to the device, even with the In-app chat in foreground. In order for the chat messages to reappear, simply call restartConnection.
717
+ * In Android In-app chat connection is automatically established and stopped based on component lifecycle. Chat connection is active only when Lifecycle.State is at least Lifecycle.State.STARTED. Chat connection is stopped when Lifecycle.State is below Lifecycle.State.STARTED.
718
+ * @name stopConnection
719
+ */
720
+ stopConnection() {
721
+ if (Platform.OS === "android") {
722
+ return;
723
+ }
724
+ RNMMChat.stopConnection();
725
+ };
699
726
  }
700
727
 
701
728
  export {ChatView, RNMMChatView} from './components/RNMMChatViewNativeComponent';