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');