infobip-mobile-messaging-react-native-plugin 13.3.0 → 13.4.1
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 +6 -5
- package/infobip-mobile-messaging-react-native-plugin-13.4.0.tgz +0 -0
- package/infobip-mobile-messaging-react-native-plugin.podspec +1 -1
- package/infobip-mobile-messaging-react-native-plugin.tgz +0 -0
- package/package.json +1 -1
- package/infobip-mobile-messaging-react-native-plugin-13.2.2.tgz +0 -0
package/android/build.gradle
CHANGED
|
@@ -32,6 +32,7 @@ import org.infobip.mobile.messaging.chat.core.widget.LivechatWidgetLanguage;
|
|
|
32
32
|
import org.infobip.mobile.messaging.mobileapi.MobileMessagingError;
|
|
33
33
|
import org.infobip.mobile.messaging.mobileapi.Result;
|
|
34
34
|
import org.infobip.mobile.messaging.util.StringUtils;
|
|
35
|
+
import org.infobip.mobile.messaging.chat.core.JwtProvider;
|
|
35
36
|
import org.infobip.reactlibrary.mobilemessaging.datamappers.ReactNativeJson;
|
|
36
37
|
import org.infobip.mobile.messaging.api.support.http.serialization.JsonSerializer;
|
|
37
38
|
import org.infobip.mobile.messaging.chat.core.MultithreadStrategy;
|
|
@@ -50,7 +51,7 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
|
|
|
50
51
|
|
|
51
52
|
private String jwt = null;
|
|
52
53
|
private boolean isJwtProviderInitialInvocation = true;
|
|
53
|
-
private final
|
|
54
|
+
private final JwtProvider jwtProvider = () -> {
|
|
54
55
|
if (!isJwtProviderInitialInvocation) {
|
|
55
56
|
//send event to JS to generate new JWT and invoke native setter, then wait 150ms and return generated JWT
|
|
56
57
|
ReactNativeEvent.send(EVENT_INAPPCHAT_JWT_REQUESTED, reactContext);
|
|
@@ -137,11 +138,11 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
|
|
|
137
138
|
public void setJwt(String jwt) {
|
|
138
139
|
this.jwt = jwt;
|
|
139
140
|
InAppChat inAppChat = InAppChat.getInstance(reactContext);
|
|
140
|
-
if (inAppChat.
|
|
141
|
-
inAppChat.
|
|
141
|
+
if (inAppChat.getWidgetJwtProvider() == null) {
|
|
142
|
+
inAppChat.setWidgetJwtProvider(jwtProvider);
|
|
142
143
|
this.isJwtProviderInitialInvocation = true;
|
|
143
|
-
} else if (inAppChat.
|
|
144
|
-
inAppChat.
|
|
144
|
+
} else if (inAppChat.getWidgetJwtProvider() != null && StringUtils.isBlank(jwt)) {
|
|
145
|
+
inAppChat.setWidgetJwtProvider(null);
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
|
|
Binary file
|
|
Binary file
|
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": "13.
|
|
4
|
+
"version": "13.4.1",
|
|
5
5
|
"description": "Infobip Mobile Messaging React Native Plugin",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"scripts": {
|
|
Binary file
|