From dbc9ecb201724e6c961b82a66aeb2623ec7fbb97 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Sat, 24 Aug 2019 04:20:22 +0200 Subject: [PATCH] do not dispatch navigation actions when opening the app from a push notification (#3184) --- 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();