@developer_tribe/react-native-comnyx 0.10.5 → 0.10.7

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.
@@ -122,22 +122,33 @@ class NotificationsHelper(private val context: Context) {
122
122
  val builder = NotificationCompat.Builder(context, CHANNEL_ID)
123
123
  .setContentTitle(title)
124
124
  .setContentText(message)
125
-
126
- val iconResourceId = context.resources.getIdentifier("com_google_firebase_messaging_default_notification_icon", "drawable", context.packageName)
127
- if (iconResourceId != 0) {
128
- builder.setSmallIcon(iconResourceId)
129
- Log.d(TAG, "Using Firebase default notification icon")
130
- } else {
131
- try {
132
- val appInfo = context.packageManager.getApplicationInfo(context.packageName, 0)
125
+
126
+ // Check if Firebase notification icon is defined in manifest metadata
127
+ try {
128
+ val appInfo = context.packageManager.getApplicationInfo(context.packageName, android.content.pm.PackageManager.GET_META_DATA)
129
+ val metaData = appInfo.metaData
130
+ var iconResourceId = 0
131
+
132
+ // Get Firebase notification icon from manifest metadata
133
+ if (metaData != null && metaData.containsKey("com.google.firebase.messaging.default_notification_icon")) {
134
+ iconResourceId = metaData.getInt("com.google.firebase.messaging.default_notification_icon", 0)
135
+ Log.d(TAG, "Found Firebase notification icon metadata: $iconResourceId")
136
+ }
137
+
138
+ if (iconResourceId != 0) {
139
+ builder.setSmallIcon(iconResourceId)
140
+ Log.d(TAG, "Using Firebase default notification icon from manifest")
141
+ } else {
142
+ // Fallback to app icon
133
143
  builder.setSmallIcon(appInfo.icon)
134
- Log.d(TAG, "Firebase default notification icon not found, using app icon as fallback")
135
- } catch (e: Exception) {
136
- builder.setSmallIcon(android.R.drawable.ic_dialog_info)
137
- Log.d(TAG, "Using system default icon as final fallback")
144
+ Log.d(TAG, "Firebase default notification icon not found in manifest, using app icon as fallback")
138
145
  }
146
+ } catch (e: Exception) {
147
+ // Ultimate fallback to Android system icon
148
+ builder.setSmallIcon(android.R.drawable.ic_dialog_info)
149
+ Log.d(TAG, "Error getting app info, using system default icon as final fallback: ${e.message}")
139
150
  }
140
-
151
+
141
152
  builder.setPriority(NotificationCompat.PRIORITY_DEFAULT)
142
153
  //.setNumber(100)
143
154
  .setAutoCancel(true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@developer_tribe/react-native-comnyx",
3
- "version": "0.10.5",
3
+ "version": "0.10.7",
4
4
  "description": "React Native chat component with integrated support panel, enabling real-time customer communication and efficient agent workflow management.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/commonjs/index.js",