From f7cbf3afd0f624c068cb579e8c7f556f9aa5a7e7 Mon Sep 17 00:00:00 2001 From: enahum Date: Fri, 11 Aug 2017 10:37:25 -0400 Subject: [PATCH] Ensure reset of version and badge when logout (#832) --- app/mattermost.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/app/mattermost.js b/app/mattermost.js index 902bc9fc3..4940a2546 100644 --- a/app/mattermost.js +++ b/app/mattermost.js @@ -170,13 +170,7 @@ export default class Mattermost { }; handleReset = () => { - const {dispatch, getState} = store; - Client4.serverVersion = ''; - Client.serverVersion = ''; - Client.token = null; - Client4.userId = ''; - PushNotifications.cancelAllLocalNotifications(); - setServerVersion('')(dispatch, getState); + this.resetBadgeAndVersion(); this.startApp('fade'); }; @@ -198,6 +192,8 @@ export default class Mattermost { InteractionManager.runAfterInteractions(() => { logout()(dispatch, getState); }); + } else { + this.resetBadgeAndVersion(); } }; @@ -262,6 +258,17 @@ export default class Mattermost { } }; + resetBadgeAndVersion = () => { + const {dispatch, getState} = store; + Client4.serverVersion = ''; + Client.serverVersion = ''; + Client.token = null; + Client4.userId = ''; + PushNotifications.setApplicationIconBadgeNumber(0); + PushNotifications.cancelAllLocalNotifications(); + setServerVersion('')(dispatch, getState); + }; + restartApp = () => { Navigation.dismissModal({animationType: 'none'}); this.startApp('fade');