From 63066f4365cf8dcf9cc55f35d91ecfa3ea45b576 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Fri, 23 Aug 2019 22:17:32 -0400 Subject: [PATCH] do not dispatch navigation actions when opening the app from a push notification (#3183) --- app/utils/push_notifications.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/utils/push_notifications.js b/app/utils/push_notifications.js index 03ead17f9..5e91342e1 100644 --- a/app/utils/push_notifications.js +++ b/app/utils/push_notifications.js @@ -43,9 +43,13 @@ class PushNotificationUtils { }; loadFromNotification = async (notification) => { + // Set appStartedFromPushNotification to avoid channel screen to call selectInitialChannel + EphemeralStore.appStartedFromPushNotification = true; await this.store.dispatch(loadFromPushNotification(notification, true)); - if (!EphemeralStore.appStartedFromPushNotification) { + // if we have a componentId means that the app is already initialized + const componentId = EphemeralStore.getNavigationTopComponentId(); + if (componentId) { EventEmitter.emit('close_channel_drawer'); EventEmitter.emit('close_settings_sidebar'); @@ -190,11 +194,11 @@ class PushNotificationUtils { }; unsubscribeFromStore = this.store.subscribe(waitForHydration); - } + }; getNotification = () => { return PushNotifications.getNotification(); - } + }; } export default new PushNotificationUtils();