From d954859868f8e02e101617bcec535d287710110d Mon Sep 17 00:00:00 2001 From: Nuno Azevedo Date: Fri, 27 Aug 2021 16:15:05 +0100 Subject: [PATCH 1/2] feat: remove code that is only used in iOS 11 and older --- src/ios/CDVWKInAppBrowser.m | 73 +++++++++---------------------------- 1 file changed, 18 insertions(+), 55 deletions(-) diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index aacf19297..a6aa301cc 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -137,66 +137,29 @@ - (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options } if (browserOptions.clearcache) { - bool isAtLeastiOS11 = false; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 - if (@available(iOS 11.0, *)) { - isAtLeastiOS11 = true; - } -#endif - - if(isAtLeastiOS11){ -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 - // Deletes all cookies - WKHTTPCookieStore* cookieStore = dataStore.httpCookieStore; - [cookieStore getAllCookies:^(NSArray* cookies) { - NSHTTPCookie* cookie; - for(cookie in cookies){ - [cookieStore deleteCookie:cookie completionHandler:nil]; - } - }]; -#endif - }else{ - // https://stackoverflow.com/a/31803708/777265 - // Only deletes domain cookies (not session cookies) - [dataStore fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] - completionHandler:^(NSArray * __nonnull records) { - for (WKWebsiteDataRecord *record in records){ - NSSet* dataTypes = record.dataTypes; - if([dataTypes containsObject:WKWebsiteDataTypeCookies]){ - [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:record.dataTypes - forDataRecords:@[record] - completionHandler:^{}]; - } - } - }]; - } + // Deletes all cookies + WKHTTPCookieStore* cookieStore = dataStore.httpCookieStore; + [cookieStore getAllCookies:^(NSArray* cookies) { + NSHTTPCookie* cookie; + for(cookie in cookies){ + [cookieStore deleteCookie:cookie completionHandler:nil]; + } + }]; } if (browserOptions.clearsessioncache) { - bool isAtLeastiOS11 = false; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 - if (@available(iOS 11.0, *)) { - isAtLeastiOS11 = true; - } -#endif - if (isAtLeastiOS11) { -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 - // Deletes session cookies - WKHTTPCookieStore* cookieStore = dataStore.httpCookieStore; - [cookieStore getAllCookies:^(NSArray* cookies) { - NSHTTPCookie* cookie; - for(cookie in cookies){ - if(cookie.sessionOnly){ - [cookieStore deleteCookie:cookie completionHandler:nil]; - } + // Deletes session cookies + WKHTTPCookieStore* cookieStore = dataStore.httpCookieStore; + [cookieStore getAllCookies:^(NSArray* cookies) { + NSHTTPCookie* cookie; + for(cookie in cookies){ + if(cookie.sessionOnly){ + [cookieStore deleteCookie:cookie completionHandler:nil]; } - }]; -#endif - }else{ - NSLog(@"clearsessioncache not available below iOS 11.0"); - } + } + }]; } - + if (self.inAppBrowserViewController == nil) { self.inAppBrowserViewController = [[CDVWKInAppBrowserViewController alloc] initWithBrowserOptions: browserOptions andSettings:self.commandDelegate.settings]; self.inAppBrowserViewController.navigationDelegate = self; From 376ec4e8cc543d23e78628ee20d512a5b13c18ff Mon Sep 17 00:00:00 2001 From: alexgerardojacinto Date: Thu, 16 Sep 2021 11:59:20 +0100 Subject: [PATCH 2/2] chore: update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18b2211d0..c52e2e726 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fix +- Removed code that is only used in iOS 11 and older [RPM-1453](https://outsystemsrd.atlassian.net/browse/RPM-1453) ### [4.0.0-OS6] - 2021-06-30 - On iOS page scrolling back to top after clicking Done in form input field [RMET-753](https://outsystemsrd.atlassian.net/browse/RMET-753)