MM-25967 await until cookies are cleared (#4413)

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
This commit is contained in:
Mattermost Build 2020-06-11 21:13:21 +02:00 committed by GitHub
parent 2b8bba7c24
commit e6547d7dc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View file

@ -169,7 +169,7 @@ class GlobalEventHandler {
resetMomentLocale();
// TODO: Handle when multi-server support is added
CookieManager.clearAll(Platform.OS === 'ios');
await CookieManager.clearAll(Platform.OS === 'ios');
PushNotifications.clearNotifications();
const cacheDir = RNFetchBlob.fs.dirs.CacheDir;
const mainPath = cacheDir.split('/').slice(0, -1).join('/');

View file

@ -7,6 +7,7 @@ import {intlShape} from 'react-intl';
import {
Dimensions,
Image,
Platform,
ScrollView,
StyleSheet,
Text,
@ -45,19 +46,19 @@ export default class LoginOptions extends PureComponent {
Dimensions.removeEventListener('change', this.orientationDidChange);
}
goToLogin = preventDoubleTap(() => {
goToLogin = preventDoubleTap(async () => {
const {intl} = this.context;
const screen = 'Login';
const title = intl.formatMessage({id: 'mobile.routes.login', defaultMessage: 'Login'});
CookieManager.clearAll(true);
await CookieManager.clearAll(Platform.OS === 'ios');
goToScreen(screen, title);
});
goToSSO = (ssoType) => {
goToSSO = async (ssoType) => {
const {intl} = this.context;
const screen = 'SSO';
const title = intl.formatMessage({id: 'mobile.routes.sso', defaultMessage: 'Single Sign-On'});
CookieManager.clearAll(true);
await CookieManager.clearAll(Platform.OS === 'ios');
goToScreen(screen, title, {ssoType});
};