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

Support empty strings as default push notification icons #1511

Merged
merged 2 commits into from
Jul 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ PushNotification.localNotification({
ticker: "My Notification Ticker", // (optional)
showWhen: true, // (optional) default: true
autoCancel: true, // (optional) default: true
largeIcon: "ic_launcher", // (optional) default: "ic_launcher"
largeIcon: "ic_launcher", // (optional) default: "ic_launcher". Use "" for no large icon.
largeIconUrl: "https://www.example.tld/picture.jpg", // (optional) default: undefined
smallIcon: "ic_notification", // (optional) default: "ic_notification" with fallback for "ic_launcher"
smallIcon: "ic_notification", // (optional) default: "ic_notification" with fallback for "ic_launcher". Use "" for default small icon.
bigText: "My big text that will be shown when notification is expanded", // (optional) default: "message" prop
subText: "This is a subText", // (optional) default: none
bigPictureUrl: "https://www.example.tld/picture.jpg", // (optional) default: undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,13 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
}

// Small icon
int smallIconResId;
int smallIconResId = 0;

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

if (smallIcon != null) {
smallIconResId = res.getIdentifier(smallIcon, "mipmap", packageName);
} else {
} else if (!smallIcon.isEmpty()) {
smallIconResId = res.getIdentifier("ic_notification", "mipmap", packageName);
}

Expand All @@ -370,13 +370,13 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB

// Large icon
if(largeIconBitmap == null) {
int largeIconResId;
int largeIconResId = 0;

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

if (largeIcon != null) {
largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName);
} else {
} else if (!largeIcon.isEmpty()) {
largeIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
}

Expand Down