From e6547d7dc1a9fdb171cb4c9a265da1dd778c6b97 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Thu, 11 Jun 2020 21:13:21 +0200 Subject: [PATCH] MM-25967 await until cookies are cleared (#4413) Co-authored-by: Elias Nahum --- app/init/global_event_handler.js | 2 +- app/screens/login_options/login_options.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/init/global_event_handler.js b/app/init/global_event_handler.js index 40ee9a3d5..8b4e002d9 100644 --- a/app/init/global_event_handler.js +++ b/app/init/global_event_handler.js @@ -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('/'); diff --git a/app/screens/login_options/login_options.js b/app/screens/login_options/login_options.js index 5b18b61c3..f4cdcd92b 100644 --- a/app/screens/login_options/login_options.js +++ b/app/screens/login_options/login_options.js @@ -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}); };