From 5eb824aeb43b164cc9433f1518a970e648812fdc Mon Sep 17 00:00:00 2001 From: Djorkaeff Alexandre Date: Fri, 28 Feb 2020 13:35:47 -0300 Subject: [PATCH] [FIX] Hide reply notification action when there are missing data (#1771) 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, 4 insertions(+), 2 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 07cab5e5b..dd2022687 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java +++ b/android/app/src/main/java/chat/rocket/reactnative/CustomPushNotification.java @@ -252,7 +252,9 @@ public class CustomPushNotification extends PushNotification { } private void notificationReply(Notification.Builder notification, int notificationId, Bundle bundle) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { + String notId = bundle.getString("notId", "1"); + String ejson = bundle.getString("ejson", "{}"); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N || notId.equals("1") || ejson.equals("{}")) { return; } String label = "Reply"; 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 cd18a292a..48c370370 100644 --- a/android/app/src/main/java/chat/rocket/reactnative/Ejson.java +++ b/android/app/src/main/java/chat/rocket/reactnative/Ejson.java @@ -30,7 +30,7 @@ public class Ejson { public String serverURL() { String url = this.host; - if (url.endsWith("/")) { + if (url != null && url.endsWith("/")) { url = url.substring(0, url.length() - 1); } return url;