From 514e9cfd08e75844f2c39e90e3b2764644f00aa2 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Fri, 12 Jun 2020 22:15:35 +0200 Subject: [PATCH] Automated cherry pick of #4418 (#4419) * Wrap await calls in try/catch * Fix spacing Co-authored-by: Miguel Alatzar --- app/init/global_event_handler.js | 6 +++++- app/screens/login_options/login_options.js | 12 ++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/init/global_event_handler.js b/app/init/global_event_handler.js index 8b4e002d9..084047424 100644 --- a/app/init/global_event_handler.js +++ b/app/init/global_event_handler.js @@ -169,7 +169,11 @@ class GlobalEventHandler { resetMomentLocale(); // TODO: Handle when multi-server support is added - await CookieManager.clearAll(Platform.OS === 'ios'); + try { + await CookieManager.clearAll(Platform.OS === 'ios'); + } catch (error) { + // Nothing to clear + } 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 f4cdcd92b..d28f23025 100644 --- a/app/screens/login_options/login_options.js +++ b/app/screens/login_options/login_options.js @@ -50,7 +50,11 @@ export default class LoginOptions extends PureComponent { const {intl} = this.context; const screen = 'Login'; const title = intl.formatMessage({id: 'mobile.routes.login', defaultMessage: 'Login'}); - await CookieManager.clearAll(Platform.OS === 'ios'); + try { + await CookieManager.clearAll(Platform.OS === 'ios'); + } catch (error) { + // Nothing to clear + } goToScreen(screen, title); }); @@ -58,7 +62,11 @@ export default class LoginOptions extends PureComponent { const {intl} = this.context; const screen = 'SSO'; const title = intl.formatMessage({id: 'mobile.routes.sso', defaultMessage: 'Single Sign-On'}); - await CookieManager.clearAll(Platform.OS === 'ios'); + try { + await CookieManager.clearAll(Platform.OS === 'ios'); + } catch (error) { + // Nothing to clear + } goToScreen(screen, title, {ssoType}); };