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

Commit d91e6e2

Browse files
authored
Merge pull request #926 from maxkomarychev/default-channel-name
Properly handle default values of metadata
2 parents b1e84b2 + 9d34168 commit d91e6e2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public RNPushNotificationConfig(Context context) {
3131

3232
public String getChannelName() {
3333
try {
34-
return metadata.getString(KEY_CHANNEL_NAME);
34+
final String name = metadata.getString(KEY_CHANNEL_NAME);
35+
if (name != null && name.length() > 0) {
36+
return name;
37+
}
3538
} catch (Exception e) {
3639
Log.w(RNPushNotification.LOG_TAG, "Unable to find " + KEY_CHANNEL_NAME + " in manifest. Falling back to default");
3740
}
@@ -40,7 +43,10 @@ public String getChannelName() {
4043
}
4144
public String getChannelDescription() {
4245
try {
43-
return metadata.getString(KEY_CHANNEL_DESCRIPTION);
46+
final String description = metadata.getString(KEY_CHANNEL_DESCRIPTION);
47+
if (description != null) {
48+
return description;
49+
}
4450
} catch (Exception e) {
4551
Log.w(RNPushNotification.LOG_TAG, "Unable to find " + KEY_CHANNEL_DESCRIPTION + " in manifest. Falling back to default");
4652
}

0 commit comments

Comments
 (0)