From 2e74b4d2492845639416b3c06673d8f11967b0bd Mon Sep 17 00:00:00 2001 From: yogevbd Date: Thu, 14 Mar 2019 11:12:06 +0200 Subject: [PATCH] Revert "Fix push receiving from dead state" This reverts commit 4cd72c4843e1bd5fb3cf6d5f84c18f826e0f5bc4. --- .../core/notification/PushNotification.java | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java b/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java index ba5e1c3..2c970e9 100644 --- a/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java +++ b/android/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java @@ -104,6 +104,7 @@ public class PushNotification implements IPushNotification { protected void digestNotification() { if (!mAppLifecycleFacade.isReactInitialized()) { setAsInitialNotification(); + launchOrResumeApp(); return; } @@ -133,6 +134,10 @@ public class PushNotification implements IPushNotification { protected void dispatchUponVisibility() { mAppLifecycleFacade.addVisibilityListener(getIntermediateAppVisibilityListener()); + + // Make the app visible so that we'll dispatch the notification opening when visibility changes to 'true' (see + // above listener registration). + launchOrResumeApp(); } protected AppVisibilityListener getIntermediateAppVisibilityListener() { @@ -204,4 +209,9 @@ public class PushNotification implements IPushNotification { private void notifyOpenedToJS() { mJsIOHelper.sendEventToJS(NOTIFICATION_OPENED_EVENT_NAME, mNotificationProps.asBundle(), mAppLifecycleFacade.getRunningReactContext()); } + + protected void launchOrResumeApp() { + final Intent intent = mAppLaunchHelper.getLaunchIntent(mContext); + mContext.startActivity(intent); + } } diff --git a/package.json b/package.json index 4f3b957..83edee1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-notifications", - "version": "1.2.52", + "version": "1.2.6", "description": "Advanced Push Notifications (Silent, interactive notifications) for iOS & Android", "author": "Lidan Hifi ", "license": "MIT", -- 2.26.2