infobip-mobile-messaging-react-native-plugin 14.1.4 → 14.2.0-rc

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.
@@ -8,6 +8,7 @@
8
8
 
9
9
  package org.infobip.reactlibrary.mobilemessaging
10
10
 
11
+ import android.annotation.SuppressLint
11
12
  import android.app.Activity
12
13
  import android.content.BroadcastReceiver
13
14
  import android.content.Context
@@ -131,13 +132,13 @@ class RNMMChatService(
131
132
  fun getMessageCounter(onSuccess: Callback) {
132
133
  runCatchingExceptions("getMessageCounter()") {
133
134
  onSuccess.invoke(inAppChat.messageCounter)
134
- }
135
+ }
135
136
  }
136
137
 
137
138
  fun resetMessageCounter() {
138
139
  runCatchingExceptions("resetMessageCounter()") {
139
140
  inAppChat.resetMessageCounter()
140
- }
141
+ }
141
142
  }
142
143
 
143
144
  fun setLanguage(localeString: String, onSuccess: Callback, onError: Callback) {
@@ -156,7 +157,7 @@ class RNMMChatService(
156
157
  }
157
158
  })
158
159
  },
159
- errorHandler = { t ->
160
+ errorHandler = { t ->
160
161
  onError.invoke(Utils.callbackError(t.message, null))
161
162
  }
162
163
  )
@@ -170,10 +171,10 @@ class RNMMChatService(
170
171
  inAppChat.sendContextualData(data, MultithreadStrategy.valueOf(multithreadStrategyFlag))
171
172
  onSuccess.invoke()
172
173
  },
173
- errorHandler = { t ->
174
- onError.invoke(Utils.callbackError(t.message, null))
174
+ errorHandler = { t ->
175
+ onError.invoke(Utils.callbackError(t.message, null))
175
176
  }
176
- )
177
+ )
177
178
  }
178
179
 
179
180
  fun setWidgetTheme(widgetTheme: String?) {
@@ -183,6 +184,7 @@ class RNMMChatService(
183
184
  }
184
185
 
185
186
  private val reactNativeDrawableLoader = object : PluginChatCustomization.DrawableLoader {
187
+ @SuppressLint("LongLogTag")
186
188
  override fun loadDrawable(context: Context, drawableSrc: String?): Drawable? {
187
189
  if (drawableSrc.isNullOrBlank()) return null
188
190
  return try {
@@ -326,7 +328,12 @@ class RNMMChatService(
326
328
  //endregion
327
329
 
328
330
  //region ActivityEventListener
329
- override fun onActivityResult(activity: Activity?, requestCode: Int, resultCode: Int, data: Intent?) {
331
+ override fun onActivityResult(
332
+ activity: Activity,
333
+ requestCode: Int,
334
+ resultCode: Int,
335
+ data: Intent?
336
+ ) {
330
337
  val fragmentActivity = Utils.getFragmentActivity(reactContext) ?: return
331
338
  val fragment = fragmentActivity.supportFragmentManager.findFragmentByTag(Utils.RN_IN_APP_CHAT_FRAGMENT_TAG)
332
339
  if (fragment == null) {
@@ -336,9 +343,6 @@ class RNMMChatService(
336
343
  fragment.onActivityResult(requestCode and 0xffff, resultCode, data)
337
344
  }
338
345
 
339
- override fun onNewIntent(intent: Intent?) {
340
- // Activity `onNewIntent` - no-op
341
- }
342
346
  //endregion
343
347
 
344
348
  //region LifecycleEventListener
@@ -367,6 +371,10 @@ class RNMMChatService(
367
371
  errorHandler?.invoke(throwable) ?: Log.e(TAG, "$functionName error: ${throwable.message}", throwable)
368
372
  }
369
373
  }
374
+
375
+ override fun onNewIntent(intent: Intent) {
376
+ TODO("Not yet implemented")
377
+ }
370
378
  //endregion
371
379
  }
372
380
 
@@ -381,8 +389,10 @@ class RNMMChatEventReceiver : ReactNativeBroadcastReceiver() {
381
389
  Log.w(TAG, "Cannot process event for broadcast: ${intent?.action}")
382
390
  return
383
391
  }
384
- val unreadChatMessagesCounter = intent.getIntExtra(BroadcastParameter.EXTRA_UNREAD_CHAT_MESSAGES_COUNT, 0)
385
- emitOrCache(context, RNMMChatService.EVENT_INAPPCHAT_UNREAD_MESSAGES_COUNT_UPDATED, unreadChatMessagesCounter)
392
+ val unreadChatMessagesCounter = intent?.getIntExtra(BroadcastParameter.EXTRA_UNREAD_CHAT_MESSAGES_COUNT, 0)
393
+ if (unreadChatMessagesCounter != null) {
394
+ emitOrCache(context, RNMMChatService.EVENT_INAPPCHAT_UNREAD_MESSAGES_COUNT_UPDATED, unreadChatMessagesCounter)
395
+ }
386
396
  }
387
397
 
388
398
  private fun emitOrCache(context: Context?, eventType: String, unreadMessagesCounter: Int) {
@@ -399,4 +409,4 @@ class RNMMChatEventReceiver : ReactNativeBroadcastReceiver() {
399
409
  Log.e(TAG, "Both reactContext and androidContext are null, can't emit or cache event " + eventType)
400
410
  }
401
411
  }
402
- }
412
+ }
@@ -114,7 +114,7 @@ class ReactNativeMobileMessagingService(
114
114
  @JvmStatic
115
115
  @Volatile
116
116
  var jsHasListeners = false
117
-
117
+
118
118
  @JvmStatic
119
119
  @Volatile
120
120
  var pluginInitialized = false
@@ -635,10 +635,11 @@ class ReactNativeMobileMessagingService(
635
635
  }
636
636
  }
637
637
 
638
- override fun onNewIntent(intent: Intent?) {
639
- // Empty implementation
638
+ override fun onNewIntent(intent: Intent) {
639
+ TODO("Not yet implemented")
640
640
  }
641
641
 
642
+
642
643
  private fun installationResultListener(successCallback: Callback, errorCallback: Callback): MobileMessaging.ResultListener<Installation> {
643
644
  return object : MobileMessaging.ResultListener<Installation>() {
644
645
  override fun onResult(result: Result<Installation, MobileMessagingError>) {
@@ -1074,7 +1075,7 @@ class MessageEventReceiver : ReactNativeBroadcastReceiver() {
1074
1075
  var actionInputText: String? = null
1075
1076
 
1076
1077
  if (InteractiveEvent.NOTIFICATION_ACTION_TAPPED.key == intent?.action) {
1077
- val notificationAction = NotificationAction.createFrom(intent.extras)
1078
+ val notificationAction = NotificationAction.createFrom(intent?.extras)
1078
1079
  actionId = notificationAction.id
1079
1080
  actionInputText = notificationAction.inputText
1080
1081
  }
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": "14.1.4",
4
+ "version": "14.2.0-rc",
5
5
  "description": "Infobip Mobile Messaging React Native Plugin",
6
6
  "main": "./src/index.js",
7
7
  "scripts": {
@@ -37,10 +37,10 @@
37
37
  "react-native": ">=0.68.0 <1.0.x"
38
38
  },
39
39
  "devDependencies": {
40
- "@react-native/codegen": "^0.79.0",
40
+ "@react-native/codegen": "^0.81.5",
41
41
  "metro-react-native-babel-preset": "^0.77.0",
42
- "react": "^19.0.0",
43
- "react-native": "^0.79.0"
42
+ "react": "^19.2.1",
43
+ "react-native": "^0.81.5"
44
44
  },
45
45
  "codegenConfig": {
46
46
  "name": "MobileMessaging",
package/release.sh CHANGED
@@ -30,4 +30,4 @@ encoded_password=$(echo ${GIT_PASSWORD} | jq -Rr @uri)
30
30
  git remote set-url origin https://${encoded_username}:${encoded_password}@git.ib-ci.com/scm/mml/infobip-mobile-messaging-react-native-plugin.git
31
31
 
32
32
  # Push changes
33
- git push origin master --tags
33
+ git push origin ${BRANCH_NAME_TO_BUILD} --tags