infobip-mobile-messaging-react-native-plugin 13.2.2 → 13.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.
- package/android/build.gradle +1 -1
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/ChatCustomization.java +35 -12
- package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/RNMMChatModule.java +6 -4
- package/infobip-mobile-messaging-react-native-plugin-13.2.2.tgz +0 -0
- package/infobip-mobile-messaging-react-native-plugin.podspec +5 -4
- package/infobip-mobile-messaging-react-native-plugin.tgz +0 -0
- package/ios/MobileMessagingPlugin/RNMMChatBridge.m +0 -1
- package/package.json +1 -1
- package/infobip-mobile-messaging-react-native-plugin-13.2.1.tgz +0 -0
package/android/build.gradle
CHANGED
package/android/src/main/java/org/infobip/reactlibrary/mobilemessaging/ChatCustomization.java
CHANGED
|
@@ -26,6 +26,7 @@ import org.infobip.mobile.messaging.chat.view.styles.InAppChatToolbarStyle;
|
|
|
26
26
|
import org.infobip.mobile.messaging.interactive.NotificationAction;
|
|
27
27
|
import org.infobip.mobile.messaging.interactive.NotificationCategory;
|
|
28
28
|
import org.infobip.mobile.messaging.storage.SQLiteMessageStore;
|
|
29
|
+
import org.infobip.mobile.messaging.util.StringUtils;
|
|
29
30
|
|
|
30
31
|
import org.infobip.mobile.messaging.api.support.http.serialization.JsonSerializer;
|
|
31
32
|
import org.json.JSONException;
|
|
@@ -44,8 +45,8 @@ public class ChatCustomization {
|
|
|
44
45
|
// Toolbar
|
|
45
46
|
private ToolbarCustomization chatToolbar;
|
|
46
47
|
private ToolbarCustomization attachmentPreviewToolbar;
|
|
47
|
-
private String
|
|
48
|
-
private String
|
|
48
|
+
private String attachmentPreviewToolbarSaveMenuItemIcon;
|
|
49
|
+
private String attachmentPreviewToolbarMenuItemsIconTint;
|
|
49
50
|
|
|
50
51
|
// NetworkError
|
|
51
52
|
private String networkErrorText;
|
|
@@ -191,7 +192,7 @@ public class ChatCustomization {
|
|
|
191
192
|
|
|
192
193
|
public InAppChatTheme createTheme(Context context) {
|
|
193
194
|
|
|
194
|
-
InAppChatToolbarStyle
|
|
195
|
+
InAppChatToolbarStyle chatToolbarStyle = new InAppChatToolbarStyle.Builder()
|
|
195
196
|
.setStatusBarBackgroundColor(parseColor(chatStatusBarBackgroundColor))
|
|
196
197
|
.setLightStatusBarIcons(chatStatusBarIconsColorMode == "light")
|
|
197
198
|
.setToolbarBackgroundColor(parseColor(chatToolbar.backgroundColor))
|
|
@@ -207,14 +208,14 @@ public class ChatCustomization {
|
|
|
207
208
|
.setIsSubtitleCentered(chatToolbar.subtitleCentered)
|
|
208
209
|
.build();
|
|
209
210
|
|
|
210
|
-
InAppChatToolbarStyle
|
|
211
|
+
InAppChatToolbarStyle attachmentPreviewToolbarStyle = new InAppChatToolbarStyle.Builder()
|
|
211
212
|
.setStatusBarBackgroundColor(parseColor(chatStatusBarBackgroundColor))
|
|
212
213
|
.setLightStatusBarIcons(chatStatusBarIconsColorMode == "light")
|
|
213
214
|
.setToolbarBackgroundColor(parseColor(attachmentPreviewToolbar.backgroundColor))
|
|
214
215
|
.setNavigationIcon(loadDrawable(attachmentPreviewToolbar.navigationIcon, context))
|
|
215
216
|
.setNavigationIconTint(parseColor(attachmentPreviewToolbar.navigationIconTint))
|
|
216
|
-
.setSaveAttachmentMenuItemIcon(loadDrawable(
|
|
217
|
-
.setMenuItemsIconTint(parseColor(
|
|
217
|
+
.setSaveAttachmentMenuItemIcon(loadDrawable(attachmentPreviewToolbarSaveMenuItemIcon, context))
|
|
218
|
+
.setMenuItemsIconTint(parseColor(attachmentPreviewToolbarMenuItemsIconTint))
|
|
218
219
|
.setTitleTextAppearance(getResId(context.getResources(), attachmentPreviewToolbar.titleTextAppearance, context.getPackageName()))
|
|
219
220
|
.setTitleTextColor(parseColor(attachmentPreviewToolbar.titleTextColor))
|
|
220
221
|
.setTitleText(attachmentPreviewToolbar.titleText)
|
|
@@ -260,18 +261,18 @@ public class ChatCustomization {
|
|
|
260
261
|
}
|
|
261
262
|
|
|
262
263
|
return new InAppChatTheme(
|
|
263
|
-
|
|
264
|
-
|
|
264
|
+
chatToolbarStyle,
|
|
265
|
+
attachmentPreviewToolbarStyle,
|
|
265
266
|
chatStyle,
|
|
266
267
|
inputViewStyleBuilder.build()
|
|
267
268
|
);
|
|
268
269
|
}
|
|
269
270
|
|
|
270
271
|
private @Nullable Integer parseColor(@Nullable String color) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return result;
|
|
272
|
+
if (StringUtils.isBlank(color)) {
|
|
273
|
+
return null;
|
|
274
274
|
}
|
|
275
|
+
@Nullable Integer result = null;
|
|
275
276
|
try {
|
|
276
277
|
result = Integer.valueOf(Color.parseColor(color));
|
|
277
278
|
} catch (IllegalArgumentException e) {
|
|
@@ -289,6 +290,9 @@ public class ChatCustomization {
|
|
|
289
290
|
* @return resource identifier or 0 if not found
|
|
290
291
|
*/
|
|
291
292
|
private @Nullable Integer getResId(Resources res, String resPath, String packageName) {
|
|
293
|
+
if (StringUtils.isBlank(resPath)) {
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
292
296
|
try {
|
|
293
297
|
int resId = res.getIdentifier(resPath, "mipmap", packageName);
|
|
294
298
|
if (resId == 0) {
|
|
@@ -307,7 +311,10 @@ public class ChatCustomization {
|
|
|
307
311
|
}
|
|
308
312
|
}
|
|
309
313
|
|
|
310
|
-
private Drawable loadDrawable(String drawableUri, Context context) {
|
|
314
|
+
private @Nullable Drawable loadDrawable(String drawableUri, Context context) {
|
|
315
|
+
if (StringUtils.isBlank(drawableUri)) {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
311
318
|
try (InputStream drawableStream = new URL(drawableUri).openStream()) {
|
|
312
319
|
return new BitmapDrawable(context.getResources(), drawableStream);
|
|
313
320
|
} catch (IOException e) {
|
|
@@ -350,6 +357,22 @@ public class ChatCustomization {
|
|
|
350
357
|
this.chatToolbar = chatToolbar;
|
|
351
358
|
}
|
|
352
359
|
|
|
360
|
+
public String getAttachmentPreviewToolbarSaveMenuItemIcon() {
|
|
361
|
+
return attachmentPreviewToolbarSaveMenuItemIcon;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
public void setAttachmentPreviewToolbarSaveMenuItemIcon(String attachmentPreviewToolbarSaveMenuItemIcon) {
|
|
365
|
+
this.attachmentPreviewToolbarSaveMenuItemIcon = attachmentPreviewToolbarSaveMenuItemIcon;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
public String getAttachmentPreviewToolbarMenuItemsIconTint() {
|
|
369
|
+
return attachmentPreviewToolbarMenuItemsIconTint;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
public void setAttachmentPreviewToolbarMenuItemsIconTint(String attachmentPreviewToolbarMenuItemsIconTint) {
|
|
373
|
+
this.attachmentPreviewToolbarMenuItemsIconTint = attachmentPreviewToolbarMenuItemsIconTint;
|
|
374
|
+
}
|
|
375
|
+
|
|
353
376
|
public String getNetworkErrorText() {
|
|
354
377
|
return networkErrorText;
|
|
355
378
|
}
|
|
@@ -28,6 +28,7 @@ import org.infobip.mobile.messaging.chat.view.styles.InAppChatInputViewStyle;
|
|
|
28
28
|
import org.infobip.mobile.messaging.chat.view.styles.InAppChatStyle;
|
|
29
29
|
import org.infobip.mobile.messaging.chat.view.styles.InAppChatTheme;
|
|
30
30
|
import org.infobip.mobile.messaging.chat.view.styles.InAppChatToolbarStyle;
|
|
31
|
+
import org.infobip.mobile.messaging.chat.core.widget.LivechatWidgetLanguage;
|
|
31
32
|
import org.infobip.mobile.messaging.mobileapi.MobileMessagingError;
|
|
32
33
|
import org.infobip.mobile.messaging.mobileapi.Result;
|
|
33
34
|
import org.infobip.mobile.messaging.util.StringUtils;
|
|
@@ -108,11 +109,12 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
|
|
|
108
109
|
|
|
109
110
|
@ReactMethod
|
|
110
111
|
public void setLanguage(String localeString, final Callback onSuccess, final Callback onError) {
|
|
111
|
-
|
|
112
|
+
LivechatWidgetLanguage widgetLanguage = LivechatWidgetLanguage.findLanguageOrDefault(localeString);
|
|
113
|
+
InAppChat.getInstance(reactContext).setLanguage(widgetLanguage, new MobileMessaging.ResultListener<LivechatWidgetLanguage>() {
|
|
112
114
|
@Override
|
|
113
|
-
public void onResult(Result<
|
|
115
|
+
public void onResult(Result<LivechatWidgetLanguage, MobileMessagingError> result) {
|
|
114
116
|
if (result.isSuccess()) {
|
|
115
|
-
onSuccess.invoke(result.getData());
|
|
117
|
+
onSuccess.invoke(result.getData().toString());
|
|
116
118
|
} else {
|
|
117
119
|
onError.invoke(Utils.callbackError(result.getError().getMessage(), null));
|
|
118
120
|
}
|
|
@@ -154,7 +156,7 @@ public class RNMMChatModule extends ReactContextBaseJavaModule implements Activi
|
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
@ReactMethod
|
|
157
|
-
public void
|
|
159
|
+
public void setWidgetTheme(String widgetTheme) {
|
|
158
160
|
if (widgetTheme != null) {
|
|
159
161
|
InAppChat inAppChat = InAppChat.getInstance(reactContext);
|
|
160
162
|
inAppChat.setWidgetTheme(widgetTheme);
|
|
Binary file
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
mmVersion = "13.5.0"
|
|
4
5
|
|
|
5
6
|
Pod::Spec.new do |s|
|
|
6
7
|
s.name = "infobip-mobile-messaging-react-native-plugin"
|
|
@@ -20,10 +21,10 @@ Pod::Spec.new do |s|
|
|
|
20
21
|
|
|
21
22
|
s.dependency "React-Core"
|
|
22
23
|
|
|
23
|
-
s.dependency "MobileMessaging/Core",
|
|
24
|
-
s.dependency "MobileMessaging/InAppChat",
|
|
25
|
-
s.dependency "MobileMessaging/Inbox",
|
|
24
|
+
s.dependency "MobileMessaging/Core", mmVersion
|
|
25
|
+
s.dependency "MobileMessaging/InAppChat", mmVersion
|
|
26
|
+
s.dependency "MobileMessaging/Inbox", mmVersion
|
|
26
27
|
if defined?($WebRTCUIEnabled)
|
|
27
|
-
s.dependency "MobileMessaging/WebRTCUI",
|
|
28
|
+
s.dependency "MobileMessaging/WebRTCUI", mmVersion
|
|
28
29
|
end
|
|
29
30
|
end
|
|
Binary file
|
|
@@ -23,7 +23,6 @@ RCT_EXTERN_METHOD(setChatCustomization:)
|
|
|
23
23
|
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
|
-
RCT_EXTERN_METHOD(sendContextualData:(NSString *)data multiThreadStrategy:(BOOL)multiThreadStrategy onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
27
26
|
RCT_EXTERN_METHOD(sendContextualData:(NSString *)data chatMultiThreadStrategy:(NSString *)chatMultiThreadStrategy onSuccess:(RCTResponseSenderBlock)successCallback onError:(RCTResponseSenderBlock)errorCallback)
|
|
28
27
|
RCT_EXTERN_METHOD(showThreadsList)
|
|
29
28
|
RCT_EXTERN_METHOD(restartConnection)
|
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.3.0",
|
|
5
5
|
"description": "Infobip Mobile Messaging React Native Plugin",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"scripts": {
|
|
Binary file
|