Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 9ae2ce5

Browse files
committed
Fix case of small/large icon null.
1 parent 471d3bb commit 9ae2ce5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,10 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
352352

353353
String smallIcon = bundle.getString("smallIcon");
354354

355-
if (smallIcon != null) {
356-
smallIconResId = res.getIdentifier(smallIcon, "mipmap", packageName);
357-
} else if (!smallIcon.isEmpty()) {
358-
smallIconResId = res.getIdentifier("ic_notification", "mipmap", packageName);
355+
if (smallIcon != null && !smallIcon.isEmpty()) {
356+
smallIconResId = res.getIdentifier(smallIcon, "mipmap", packageName);
357+
} else if(smallIcon == null) {
358+
smallIconResId = res.getIdentifier("ic_notification", "mipmap", packageName);
359359
}
360360

361361
if (smallIconResId == 0) {
@@ -374,10 +374,10 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
374374

375375
String largeIcon = bundle.getString("largeIcon");
376376

377-
if (largeIcon != null) {
378-
largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName);
379-
} else if (!largeIcon.isEmpty()) {
380-
largeIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
377+
if (largeIcon != null && !largeIcon.isEmpty()) {
378+
largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName);
379+
} else if(largeIcon == null) {
380+
largeIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
381381
}
382382

383383
// Before Lolipop there was no large icon for notifications.

0 commit comments

Comments
 (0)