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.
@@ -87,7 +87,7 @@ repositories {
87
87
  }
88
88
 
89
89
  dependencies {
90
- def mmVersion = '13.13.1'
90
+ def mmVersion = '13.18.0'
91
91
  //react and mm dependencies clash
92
92
  if (!overrideKotlinVersion.empty) {
93
93
  constraints {
@@ -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 attachmentPreviewSaveMenuItemIcon;
48
- private String attachmentPreviewMenuItemsIconTint;
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 toolbarStyle = new InAppChatToolbarStyle.Builder()
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 attachmentToolbarStyle = new InAppChatToolbarStyle.Builder()
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(attachmentPreviewSaveMenuItemIcon, context))
217
- .setMenuItemsIconTint(parseColor(attachmentPreviewMenuItemsIconTint))
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
- toolbarStyle,
264
- attachmentToolbarStyle,
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
- @Nullable Integer result = null;
272
- if (color == null) {
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
- InAppChat.getInstance(reactContext).setLanguage(localeString, new MobileMessaging.ResultListener<String>() {
112
+ LivechatWidgetLanguage widgetLanguage = LivechatWidgetLanguage.findLanguageOrDefault(localeString);
113
+ InAppChat.getInstance(reactContext).setLanguage(widgetLanguage, new MobileMessaging.ResultListener<LivechatWidgetLanguage>() {
112
114
  @Override
113
- public void onResult(Result<String, MobileMessagingError> 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 setWidgetTheme(String widgetTheme) {
159
+ public void setWidgetTheme(String widgetTheme) {
158
160
  if (widgetTheme != null) {
159
161
  InAppChat inAppChat = InAppChat.getInstance(reactContext);
160
162
  inAppChat.setWidgetTheme(widgetTheme);
@@ -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", "13.0.1"
24
- s.dependency "MobileMessaging/InAppChat", "13.0.1"
25
- s.dependency "MobileMessaging/Inbox", "13.0.1"
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", "13.0.1"
28
+ s.dependency "MobileMessaging/WebRTCUI", mmVersion
28
29
  end
29
30
  end
@@ -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.2.2",
4
+ "version": "13.3.0",
5
5
  "description": "Infobip Mobile Messaging React Native Plugin",
6
6
  "main": "./src/index.js",
7
7
  "scripts": {