Ensure reset of version and badge when logout (#832)

This commit is contained in:
enahum
2017-08-11 10:37:25 -04:00
committed by GitHub
parent aeb3691696
commit f7cbf3afd0

View File

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