From 40bc598f166da840e15d735d821c060dd408e33a Mon Sep 17 00:00:00 2001 From: noumantahir Date: Fri, 1 Jul 2022 20:51:18 +0500 Subject: [PATCH] repositions device notification registering --- .../application/container/applicationContainer.tsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/screens/application/container/applicationContainer.tsx b/src/screens/application/container/applicationContainer.tsx index c9a5da614..e996c63bc 100644 --- a/src/screens/application/container/applicationContainer.tsx +++ b/src/screens/application/container/applicationContainer.tsx @@ -433,11 +433,11 @@ class ApplicationContainer extends Component { _fetchApp = async () => { - this._initNotificationSettings(); await this._getSettings(); this._refreshGlobalProps(); await this._getUserDataFromRealm(); this._compareAndPromptForUpdate(); + this._registerDeviceForNotifications(); }; _pushNavigate = (notification) => { @@ -800,24 +800,20 @@ class ApplicationContainer extends Component { ); dispatch(changeAllNotificationSettings(settings)); - this._initNotificationSettings(settings); } - dispatch(setSettingsMigrated(true)) + await dispatch(setSettingsMigrated(true)) } }; //update notification settings and update push token for each signed accoutn useing access tokens - _initNotificationSettings = (settings?:any) => { + _registerDeviceForNotifications = (settings?:any) => { const { otherAccounts, notificationDetails, isNotificationsEnabled } = this.props; - - if(!settings){ - settings = notificationDetails; - } - + const isEnabled = settings ? !!settings.notification : isNotificationsEnabled; + settings = settings || notificationDetails; //updateing fcm token with settings;