From 1aadb883928b89d4d4cd443f596163fbb080addc Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Tue, 7 Jan 2020 14:50:11 -0300 Subject: [PATCH] [FIX] Server Test Push Notification (#1508) Co-authored-by: Diego Mello --- .../java/chat/rocket/reactnative/CustomPushNotification.java | 4 ++-- android/app/src/main/java/chat/rocket/reactnative/Ejson.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java b/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java index fe1101e37..c888391b5 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java +++ b/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java @@ -61,7 +61,7 @@ public class CustomPushNotification extends PushNotification { } notificationMessages.get(notId).add(message); - super.postNotification(Integer.parseInt(notId)); + super.postNotification(notId != null ? Integer.parseInt(notId) : 1); notifyReceivedToJS(); } @@ -91,7 +91,7 @@ public class CustomPushNotification extends PushNotification { .setDefaults(Notification.DEFAULT_ALL) .setAutoCancel(true); - Integer notificationId = Integer.parseInt(notId); + Integer notificationId = notId != null ? Integer.parseInt(notId) : 1; notificationChannel(notification); notificationIcons(notification, bundle); notificationStyle(notification, notificationId, bundle); diff --git a/android/app/src/main/java/chat/rocket/reactnative/Ejson.java b/android/app/src/main/java/chat/rocket/reactnative/Ejson.java index 6ef2dfb3d..591fda93a 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/Ejson.java +++ b/android/app/src/main/java/chat/rocket/reactnative/Ejson.java @@ -14,7 +14,7 @@ public class Ejson { private SharedPreferences sharedPreferences = RNUserDefaultsModule.getPreferences(CustomPushNotification.reactApplicationContext); public String getAvatarUri() { - if (!type.equals("d")) { + if (type == null || !type.equals("d")) { return null; } return serverURL() + "/avatar/" + this.sender.username + "?rc_token=" + token() + "&rc_uid=" + userId();