From 67a28d0af3659d1a10d2fec68c38aed840abc1a0 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 5 Sep 2019 19:23:23 +0900 Subject: [PATCH] MM-18179 Clear cache and cookies for SSO login (#3220) * MM-18179 Clear cache and cookies for SSO login * Update app/components/failed_network_action/index.js Co-Authored-By: Miguel Alatzar --- app/components/failed_network_action/index.js | 6 +++--- native_modules/RNCookieManagerIOS.m | 11 +---------- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/app/components/failed_network_action/index.js b/app/components/failed_network_action/index.js index 385939c68..3fe3a3d11 100644 --- a/app/components/failed_network_action/index.js +++ b/app/components/failed_network_action/index.js @@ -13,7 +13,7 @@ import Cloud from './cloud'; export default class FailedNetworkAction extends PureComponent { static propTypes = { - action: PropTypes.func, + onRetry: PropTypes.func.isRequired, actionId: PropTypes.string, actionDefaultMessage: PropTypes.string, errorId: PropTypes.string, @@ -29,7 +29,7 @@ export default class FailedNetworkAction extends PureComponent { }; render() { - const {action, actionId, actionDefaultMessage, errorId, errorDefaultMessage, theme} = this.props; + const {actionId, actionDefaultMessage, errorId, errorDefaultMessage, onRetry, theme} = this.props; const style = getStyleFromTheme(theme); const errorTitle = { @@ -59,7 +59,7 @@ export default class FailedNetworkAction extends PureComponent { id={actionId} defaultMessage={actionDefaultMessage} style={style.link} - onPress={action} + onPress={onRetry} /> ), }} diff --git a/native_modules/RNCookieManagerIOS.m b/native_modules/RNCookieManagerIOS.m index dfd067ef7..7feff14b0 100644 --- a/native_modules/RNCookieManagerIOS.m +++ b/native_modules/RNCookieManagerIOS.m @@ -174,16 +174,7 @@ RCT_EXPORT_METHOD( WKHTTPCookieStore *cookieStore = [[WKWebsiteDataStore defaultDataStore] httpCookieStore]; [cookieStore getAllCookies:^(NSArray *allCookies) { for(NSHTTPCookie *currentCookie in allCookies) { - // Uses the NSHTTPCookie directly has no effect, nor deleted the cookie nor thrown an error. - // Create a new cookie with the given values and delete this one do the work. - NSMutableDictionary *cookieData = [NSMutableDictionary dictionary]; - [cookieData setValue:currentCookie.name forKey:NSHTTPCookieName]; - [cookieData setValue:currentCookie.value forKey:NSHTTPCookieValue]; - [cookieData setValue:currentCookie.domain forKey:NSHTTPCookieDomain]; - [cookieData setValue:currentCookie.path forKey:NSHTTPCookiePath]; - - NSHTTPCookie *newCookie = [NSHTTPCookie cookieWithProperties:cookieData]; - [cookieStore deleteCookie:newCookie completionHandler:^{}]; + [cookieStore deleteCookie:currentCookie completionHandler:^{}]; } resolve(nil); }]; diff --git a/package-lock.json b/package-lock.json index aebb758fc..f7c5cfabf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mattermost-mobile", - "version": "1.22.1", + "version": "1.23.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 2b7e0b789..928c4904d 100644 --- a/package.json +++ b/package.json @@ -148,4 +148,4 @@ "node_modules/(?!react-native|jail-monkey)" ] } -} \ No newline at end of file +}