From 4549ecdd94c66795015094ee9c8469a2a572a9e4 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Thu, 12 Aug 2021 20:29:36 +0200 Subject: [PATCH] Android Send Notification event to JS only once when the app is in the foreground (#5620) (#5621) (cherry picked from commit 8953f296231f898a77f176a66021810aa32e636c) Co-authored-by: Elias Nahum --- .../java/com/mattermost/rnbeta/CustomPushNotification.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java index 213c85202..b4cc35110 100644 --- a/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java +++ b/android/app/src/main/java/com/mattermost/rnbeta/CustomPushNotification.java @@ -119,8 +119,9 @@ public class CustomPushNotification extends PushNotification { switch (type) { case PUSH_TYPE_MESSAGE: case PUSH_TYPE_SESSION: - boolean createSummary = type.equals(PUSH_TYPE_MESSAGE); if (!mAppLifecycleFacade.isAppVisible()) { + boolean createSummary = type.equals(PUSH_TYPE_MESSAGE); + if (type.equals(PUSH_TYPE_MESSAGE)) { if (channelId != null) { Map> notificationsInChannel = loadNotificationsMap(mContext); @@ -145,8 +146,6 @@ public class CustomPushNotification extends PushNotification { } buildNotification(notificationId, createSummary); - } else { - notifyReceivedToJS(); } break; case PUSH_TYPE_CLEAR: