From 840c71b2ef4ec8d4addeb53810449aaf330e3dfd Mon Sep 17 00:00:00 2001 From: Max Zimmermann <72440045+maxmitz@users.noreply.github.com> Date: Wed, 31 May 2023 09:50:58 +0200 Subject: [PATCH 1/7] Update MyCookieManager.swift Added force unwrap fix --- ios/Classes/MyCookieManager.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ios/Classes/MyCookieManager.swift b/ios/Classes/MyCookieManager.swift index f8fca748..292c1038 100755 --- a/ios/Classes/MyCookieManager.swift +++ b/ios/Classes/MyCookieManager.swift @@ -131,6 +131,12 @@ public class MyCookieManager: ChannelDelegate { } } + + if let cookie = HTTPCookie(properties: properties) { + httpCookieStore.setCookie(cookie, completionHandler: {() in + result(true) + }) + } let cookie = HTTPCookie(properties: properties)! MyCookieManager.httpCookieStore.setCookie(cookie, completionHandler: {() in From ab98855c8a842cc24a3730ec1f6c1c708dde1f26 Mon Sep 17 00:00:00 2001 From: Max Zimmermann <72440045+maxmitz@users.noreply.github.com> Date: Wed, 31 May 2023 10:15:04 +0200 Subject: [PATCH 2/7] Update MyCookieManager.swift Updated force unwrap --- ios/Classes/MyCookieManager.swift | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ios/Classes/MyCookieManager.swift b/ios/Classes/MyCookieManager.swift index 292c1038..5e5b1e8b 100755 --- a/ios/Classes/MyCookieManager.swift +++ b/ios/Classes/MyCookieManager.swift @@ -133,15 +133,10 @@ public class MyCookieManager: ChannelDelegate { if let cookie = HTTPCookie(properties: properties) { - httpCookieStore.setCookie(cookie, completionHandler: {() in - result(true) - }) + MyCookieManager.httpCookieStore.setCookie(cookie, completionHandler: {() in + result(true) + }) } - let cookie = HTTPCookie(properties: properties)! - - MyCookieManager.httpCookieStore.setCookie(cookie, completionHandler: {() in - result(true) - }) } public static func getCookies(url: String, result: @escaping FlutterResult) { From c3f24205ed3b0c529f5dcfa62d926a8c177617a8 Mon Sep 17 00:00:00 2001 From: Max Zimmermann Date: Thu, 28 Sep 2023 16:20:42 +0200 Subject: [PATCH 3/7] Change text cursor color to black --- android/src/main/res/values/styles.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/android/src/main/res/values/styles.xml b/android/src/main/res/values/styles.xml index 13b55bde..8076a93d 100755 --- a/android/src/main/res/values/styles.xml +++ b/android/src/main/res/values/styles.xml @@ -1,11 +1,11 @@ From f3e8e11a7d2a295dc992f4e2e107aad066cafe6a Mon Sep 17 00:00:00 2001 From: Max Zimmermann Date: Thu, 5 Oct 2023 13:33:40 +0200 Subject: [PATCH 4/7] Use Android colors --- android/src/main/res/values/styles.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/src/main/res/values/styles.xml b/android/src/main/res/values/styles.xml index 8076a93d..c714f4be 100755 --- a/android/src/main/res/values/styles.xml +++ b/android/src/main/res/values/styles.xml @@ -1,11 +1,11 @@ From 228030cf19941ee31045eb783a609f61fe7937b2 Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Fri, 10 Nov 2023 14:00:11 +0100 Subject: [PATCH 5/7] Update styles.xml --- android/src/main/res/values/styles.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/android/src/main/res/values/styles.xml b/android/src/main/res/values/styles.xml index c714f4be..13b55bde 100755 --- a/android/src/main/res/values/styles.xml +++ b/android/src/main/res/values/styles.xml @@ -1,11 +1,11 @@ From 600bceafc0fda92670cd1f59a592f72c92c6f81e Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Fri, 10 Nov 2023 14:04:34 +0100 Subject: [PATCH 6/7] Update MyCookieManager.swift return false if cookie is not created --- ios/Classes/MyCookieManager.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ios/Classes/MyCookieManager.swift b/ios/Classes/MyCookieManager.swift index 5e5b1e8b..1af7f8d6 100755 --- a/ios/Classes/MyCookieManager.swift +++ b/ios/Classes/MyCookieManager.swift @@ -136,6 +136,8 @@ public class MyCookieManager: ChannelDelegate { MyCookieManager.httpCookieStore.setCookie(cookie, completionHandler: {() in result(true) }) + } else { + result(false) } } From 85ff5ec176425f2d6cb2d347e9385c1b5b69205a Mon Sep 17 00:00:00 2001 From: Lorenzo Pichilli Date: Fri, 10 Nov 2023 14:22:11 +0100 Subject: [PATCH 7/7] fixed macOS forced unwrap null value HTTPCookie for CookieManager.setCookie --- CHANGELOG.md | 1 + macos/Classes/MyCookieManager.swift | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df781e6d..8e064e4a 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Merged "feat(ios): optional tradeoff to fix ios input delay" [#1665](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1665) (thanks to [andreasgangso](https://github.com/andreasgangso)) - Merged "Fix ios multiple flutter presenting error" [#1736](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1736) (thanks to [AlexT84](https://github.com/AlexT84)) - Merged "fix cert parsing for ios 12" [#1822](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1822) (thanks to [darkang3lz92](https://github.com/darkang3lz92)) +- Merged "Fix iOS and macOS Forced unwrap null value HTTPCookie for CookieManager.setCookie" [#1677](https://github.com/pichillilorenzo/flutter_inappwebview/pull/1677) (thanks to [maxmitz](https://github.com/maxmitz)) ## 6.0.0-beta.25 diff --git a/macos/Classes/MyCookieManager.swift b/macos/Classes/MyCookieManager.swift index 9ccce940..eed128a8 100755 --- a/macos/Classes/MyCookieManager.swift +++ b/macos/Classes/MyCookieManager.swift @@ -132,11 +132,13 @@ public class MyCookieManager: ChannelDelegate { } } - let cookie = HTTPCookie(properties: properties)! - - MyCookieManager.httpCookieStore.setCookie(cookie, completionHandler: {() in - result(true) - }) + if let cookie = HTTPCookie(properties: properties) { + MyCookieManager.httpCookieStore.setCookie(cookie, completionHandler: {() in + result(true) + }) + } else { + result(false) + } } public static func getCookies(url: String, result: @escaping FlutterResult) {