Skip to content

Commit 1c44dbf

Browse files
authored
[webview_flutter_wkwebview] Require iOS 15 / macOS 12 and drop deprecated SecTrustGetCertificateAtIndex code path (#13294)
1. Pick up the iOS 15 minimum from the previously-updated Flutter 3.47. Remove old availability checks. This removes usage of `SecTrustGetCertificateAtIndex` which was deprecated in iOS 15. 2. Also hitting deprecation `'webView(forIdentifier:withPluginRegistry:)' is deprecated: Use webView(forIdentifier:withPluginRegistrar:) instead.` in `FWFWebViewFlutterWKWebViewExternalAPITests`. Mark the two tests as `@available(*, deprecated)` to suppress, and so the tests are still run since the deprecated API is public. This wasn't showing up in CI due to flutter/flutter#194517. Fixes flutter/flutter#194585 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 10a178c commit 1c44dbf

20 files changed

Lines changed: 47 additions & 134 deletions

‎packages/webview_flutter/webview_flutter/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
## NEXT
22

33
* Updates minimum supported SDK version to Flutter 3.41/Dart 3.11.
4+
* Updates README to reflect that the latest version of `webview_flutter_wkwebview`
5+
requires iOS 15 and macOS 12.
6+
* Applications built with older versions of Flutter will continue to use
7+
compatible versions of the platform implementation.
48

59
## 4.14.1
610

‎packages/webview_flutter/webview_flutter/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ On Android the WebView widget is backed by a [WebView](https://developer.android
1111

1212
| | Android | iOS | macOS |
1313
|-------------|---------|-------|--------|
14-
| **Support** | SDK 24+ | 13.0+ | 10.15+ |
14+
| **Support** | SDK 24+ | 15.0+ | 12.0+ |
1515

1616
## Usage
1717

‎packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 3.27.1
2+
3+
* Updates minimum iOS version to 15 and minimum macOS version to 12.
4+
* Removes the pre-iOS 15/macOS 12 code path that used the deprecated `SecTrustGetCertificateAtIndex`.
5+
16
## 3.27.0
27

38
* Adds `WebKitWebViewWidgetCreationParams.uiKitGestureBlockingPolicy` for choosing the gesture

‎packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/FWFWebViewFlutterWKWebViewExternalAPITests.swift‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import WebKit
1717
#endif
1818

1919
@Suite struct FWFWebViewFlutterWKWebViewExternalAPITests {
20+
// Silences the deprecation warning, the deprecated method is still public API and should be tested.
21+
@available(*, deprecated)
2022
@MainActor @Test func webViewForIdentifier() throws {
2123
let registry = TestRegistry()
2224

@@ -40,6 +42,7 @@ import WebKit
4042
#expect(result == webView)
4143
}
4244

45+
@available(*, deprecated)
4346
@MainActor @Test func webViewForIdentifierHandlesIncorrectRegistry() throws {
4447
let registry = TestRegistry()
4548
// Ensure that passing an empty registry, such as the FlutterAppDelegate

‎packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/PreferencesProxyAPITests.swift‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,14 @@ import WebKit
99
@testable import webview_flutter_wkwebview
1010

1111
@Suite struct PreferencesProxyAPITests {
12-
@MainActor @Test func setJavaScriptEnabled() throws {
13-
if #available(iOS 14.0, macOS 11.0, *) {
14-
return
15-
16-
} else {
17-
let registrar = TestProxyApiRegistrar()
18-
let api = registrar.apiDelegate.pigeonApiWKPreferences(registrar)
12+
@MainActor @Test func setJavaScriptEnabledThrowsUnsupported() throws {
13+
let registrar = TestProxyApiRegistrar()
14+
let api = registrar.apiDelegate.pigeonApiWKPreferences(registrar)
1915

20-
let instance = WKPreferences()
21-
let enabled = true
16+
let instance = WKPreferences()
17+
#expect(throws: (any Error).self) {
2218
try api.pigeonDelegate.setJavaScriptEnabled(
23-
pigeonApi: api, pigeonInstance: instance, enabled: enabled)
24-
25-
#expect(instance.javaScriptEnabled == enabled)
19+
pigeonApi: api, pigeonInstance: instance, enabled: true)
2620
}
2721
}
2822

‎packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/SecTrustProxyAPITests.swift‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ class TestSecTrustProxyAPIDelegate: SecTrustProxyAPIDelegate {
121121
}
122122

123123
override func secTrustCopyCertificateChain(_ trust: SecTrust) -> CFArray? {
124-
if #available(iOS 15.0, *) {
125-
return [createDummyCertificate()] as CFArray
126-
}
127-
128-
return nil
124+
return [createDummyCertificate()] as CFArray
129125
}
130126
}

‎packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/UIDelegateProxyAPITests.swift‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import WebKit
3333
#expect(result == nil)
3434
}
3535

36-
@available(iOS 15.0, macOS 12.0, *)
3736
@MainActor @Test func requestMediaCapturePermission() async throws {
3837
let api = TestDelegateApi()
3938
let registrar = TestProxyApiRegistrar()

‎packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewConfigurationProxyAPITests.swift‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ import WebKit
100100
#endif
101101
}
102102

103-
@available(iOS 14.0, macOS 11.0, *)
104103
@MainActor @Test func setLimitsNavigationsToAppBoundDomains() throws {
105104
let registrar = TestProxyApiRegistrar()
106105
let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar)

‎packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebpagePreferencesProxyAPITests.swift‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import WebKit
99
@testable import webview_flutter_wkwebview
1010

1111
@Suite struct WebpagePreferencesProxyAPITests {
12-
@available(iOS 14.0, macOS 11.0, *)
1312
@MainActor @Test func setAllowsContentJavaScript() throws {
1413
let registrar = TestProxyApiRegistrar()
1514
let api = registrar.apiDelegate.pigeonApiWKWebpagePreferences(registrar)

‎packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview.podspec‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Downloaded by pub (not CocoaPods).
1717
s.source_files = 'webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/**/*.swift'
1818
s.ios.dependency 'Flutter'
1919
s.osx.dependency 'FlutterMacOS'
20-
s.ios.deployment_target = '13.0'
21-
s.osx.deployment_target = '10.15'
20+
s.ios.deployment_target = '15.0'
21+
s.osx.deployment_target = '12.0'
2222
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2323
s.resource_bundles = {'webview_flutter_wkwebview_privacy' => ['webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/Resources/PrivacyInfo.xcprivacy']}
2424
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }

0 commit comments

Comments
 (0)