diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md index e0cba649e15..cfc1a99938f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md @@ -1,3 +1,10 @@ +## 3.18.1 + +* Fixes bug that would allow the API wrapper to return `null` when a non-null value was required in + a callback method. +* Changes default method to enable JavaScript for web content to + `WKWebpagePreferences.allowsContentJavaScript`. + ## 3.18.0 * Updates internal API wrapper to use ProxyApis. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/PreferencesProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/PreferencesProxyAPITests.swift index 787ff4de54a..7088f93833e 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/PreferencesProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/PreferencesProxyAPITests.swift @@ -8,15 +8,20 @@ import XCTest @testable import webview_flutter_wkwebview class PreferencesProxyAPITests: XCTestCase { - @MainActor func testSetJavaScriptEnabled() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKPreferences(registrar) + @MainActor func testSetJavaScriptEnabled() throws { + if #available(iOS 14.0, macOS 11.0, *) { + throw XCTSkip("Required API is not available for this test.") - let instance = WKPreferences() - let enabled = true - try? api.pigeonDelegate.setJavaScriptEnabled( - pigeonApi: api, pigeonInstance: instance, enabled: enabled) + } else { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKPreferences(registrar) - XCTAssertEqual(instance.javaScriptEnabled, enabled) + let instance = WKPreferences() + let enabled = true + try? api.pigeonDelegate.setJavaScriptEnabled( + pigeonApi: api, pigeonInstance: instance, enabled: enabled) + + XCTAssertEqual(instance.javaScriptEnabled, enabled) + } } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewConfigurationProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewConfigurationProxyAPITests.swift index b1b9f2f5615..431b3915f97 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewConfigurationProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebViewConfigurationProxyAPITests.swift @@ -123,4 +123,16 @@ class WebViewConfigurationProxyAPITests: XCTestCase { XCTAssertEqual(instance.mediaTypesRequiringUserActionForPlayback, []) } + + @available(iOS 13.0, macOS 10.15, *) + @MainActor func testGetDefaultWebpagePreferences() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = WKWebViewConfiguration() + let value = try? api.pigeonDelegate.getDefaultWebpagePreferences( + pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.defaultWebpagePreferences) + } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebpagePreferencesProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebpagePreferencesProxyAPITests.swift new file mode 100644 index 00000000000..aa11b48ad1e --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/WebpagePreferencesProxyAPITests.swift @@ -0,0 +1,23 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import WebKit +import XCTest + +@testable import webview_flutter_wkwebview + +class WebpagePreferencesProxyAPITests: XCTestCase { + @available(iOS 14.0, macOS 11.0, *) + @MainActor func testSetAllowsContentJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebpagePreferences(registrar) + + let instance = WKWebpagePreferences() + let allow = true + try? api.pigeonDelegate.setAllowsContentJavaScript( + pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.allowsContentJavaScript, allow) + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/PreferencesProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/PreferencesProxyAPIDelegate.swift index 805f78a4e13..aca8f398ace 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/PreferencesProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/PreferencesProxyAPIDelegate.swift @@ -12,6 +12,15 @@ class PreferencesProxyAPIDelegate: PigeonApiDelegateWKPreferences { func setJavaScriptEnabled( pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool ) throws { - pigeonInstance.javaScriptEnabled = enabled + if #available(iOS 14.0, macOS 11.0, *) { + // On iOS 14 and macOS 11, WKWebpagePreferences.allowsContentJavaScript should be + // used instead. + throw (pigeonApi.pigeonRegistrar as! ProxyAPIRegistrar) + .createUnsupportedVersionError( + method: "WKPreferences.javaScriptEnabled", + versionRequirements: "< iOS 14.0, macOS 11.0") + } else { + pigeonInstance.javaScriptEnabled = enabled + } } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift index 11064da2c3d..607001b2bc5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/ProxyAPIRegistrar.swift @@ -273,4 +273,11 @@ class ProxyAPIDelegate: WebKitLibraryPigeonProxyApiDelegate { func pigeonApiURL(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURL { return PigeonApiURL(pigeonRegistrar: registrar, delegate: URLProxyAPIDelegate()) } + + func pigeonApiWKWebpagePreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKWebpagePreferences + { + return PigeonApiWKWebpagePreferences( + pigeonRegistrar: registrar, delegate: WebpagePreferencesProxyAPIDelegate()) + } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift index c2f66df0a4b..81c25c9fa63 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebKitLibrary.g.swift @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.7.2), do not edit directly. +// Autogenerated from Pigeon (v24.1.1), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -23,9 +23,9 @@ import WebKit final class PigeonError: Error { let code: String let message: String? - let details: Any? + let details: Sendable? - init(code: String, message: String?, details: Any?) { + init(code: String, message: String?, details: Sendable?) { self.code = code self.message = message self.details = details @@ -365,7 +365,7 @@ private class WebKitLibraryPigeonInstanceManagerApi { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -488,6 +488,10 @@ protocol WebKitLibraryPigeonProxyApiDelegate { /// An implementation of [PigeonApiURL] used to add a new Dart instance of /// `URL` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiURL(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURL + /// An implementation of [PigeonApiWKWebpagePreferences] used to add a new Dart instance of + /// `WKWebpagePreferences` to the Dart `InstanceManager` and make calls to Dart. + func pigeonApiWKWebpagePreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKWebpagePreferences } extension WebKitLibraryPigeonProxyApiDelegate { @@ -585,6 +589,8 @@ open class WebKitLibraryPigeonProxyApiRegistrar { binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) PigeonApiURL.setUpMessageHandlers( binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) + PigeonApiWKWebpagePreferences.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) } func tearDown() { WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( @@ -613,6 +619,7 @@ open class WebKitLibraryPigeonProxyApiRegistrar { PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( binaryMessenger: binaryMessenger, api: nil) PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) } } private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStandardReaderWriter { @@ -632,6 +639,9 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand let identifier = self.readValue() let instance: AnyObject? = pigeonRegistrar.instanceManager.instance( forIdentifier: identifier is Int64 ? identifier as! Int64 : Int64(identifier as! Int32)) + if instance == nil { + print("Failed to find instance with identifier: \(identifier!)") + } return instance default: return super.readValue(ofType: type) @@ -1008,6 +1018,18 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand return } + if #available(iOS 13.0.0, macOS 10.15.0, *), let instance = value as? WKWebpagePreferences { + pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } + if let instance = value as? NSObject { pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance @@ -1683,32 +1705,30 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -1747,34 +1767,32 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let statusCodeArg = try! pigeonDelegate.statusCode( - pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPURLResponse.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, statusCodeArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let statusCodeArg = try! pigeonDelegate.statusCode( + pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPURLResponse.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, statusCodeArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -1809,32 +1827,30 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.URLResponse.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.URLResponse.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -1919,39 +1935,37 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let sourceArg = try! pigeonDelegate.source(pigeonApi: self, pigeonInstance: pigeonInstance) - let injectionTimeArg = try! pigeonDelegate.injectionTime( - pigeonApi: self, pigeonInstance: pigeonInstance) - let isForMainFrameOnlyArg = try! pigeonDelegate.isForMainFrameOnly( - pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [pigeonIdentifierArg, sourceArg, injectionTimeArg, isForMainFrameOnlyArg] as [Any?] - ) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let sourceArg = try! pigeonDelegate.source(pigeonApi: self, pigeonInstance: pigeonInstance) + let injectionTimeArg = try! pigeonDelegate.injectionTime( + pigeonApi: self, pigeonInstance: pigeonInstance) + let isForMainFrameOnlyArg = try! pigeonDelegate.isForMainFrameOnly( + pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [pigeonIdentifierArg, sourceArg, injectionTimeArg, isForMainFrameOnlyArg] as [Any?] + ) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -1998,39 +2012,37 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let requestArg = try! pigeonDelegate.request(pigeonApi: self, pigeonInstance: pigeonInstance) - let targetFrameArg = try! pigeonDelegate.targetFrame( - pigeonApi: self, pigeonInstance: pigeonInstance) - let navigationTypeArg = try! pigeonDelegate.navigationType( - pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationAction.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [pigeonIdentifierArg, requestArg, targetFrameArg, navigationTypeArg] as [Any?] - ) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let requestArg = try! pigeonDelegate.request(pigeonApi: self, pigeonInstance: pigeonInstance) + let targetFrameArg = try! pigeonDelegate.targetFrame( + pigeonApi: self, pigeonInstance: pigeonInstance) + let navigationTypeArg = try! pigeonDelegate.navigationType( + pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationAction.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [pigeonIdentifierArg, requestArg, targetFrameArg, navigationTypeArg] as [Any?] + ) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2074,36 +2086,35 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let responseArg = try! pigeonDelegate.response(pigeonApi: self, pigeonInstance: pigeonInstance) - let isForMainFrameArg = try! pigeonDelegate.isForMainFrame( - pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationResponse.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, responseArg, isForMainFrameArg] as [Any?]) { - response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let responseArg = try! pigeonDelegate.response( + pigeonApi: self, pigeonInstance: pigeonInstance) + let isForMainFrameArg = try! pigeonDelegate.isForMainFrame( + pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationResponse.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, responseArg, isForMainFrameArg] as [Any?]) { + response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2144,35 +2155,33 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let isMainFrameArg = try! pigeonDelegate.isMainFrame( - pigeonApi: self, pigeonInstance: pigeonInstance) - let requestArg = try! pigeonDelegate.request(pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKFrameInfo.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, isMainFrameArg, requestArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let isMainFrameArg = try! pigeonDelegate.isMainFrame( + pigeonApi: self, pigeonInstance: pigeonInstance) + let requestArg = try! pigeonDelegate.request(pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKFrameInfo.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, isMainFrameArg, requestArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2211,36 +2220,35 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let codeArg = try! pigeonDelegate.code(pigeonApi: self, pigeonInstance: pigeonInstance) - let domainArg = try! pigeonDelegate.domain(pigeonApi: self, pigeonInstance: pigeonInstance) - let userInfoArg = try! pigeonDelegate.userInfo(pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.NSError.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, codeArg, domainArg, userInfoArg] as [Any?]) { - response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let codeArg = try! pigeonDelegate.code(pigeonApi: self, pigeonInstance: pigeonInstance) + let domainArg = try! pigeonDelegate.domain(pigeonApi: self, pigeonInstance: pigeonInstance) + let userInfoArg = try! pigeonDelegate.userInfo( + pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.NSError.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, codeArg, domainArg, userInfoArg] as [Any?]) { + response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2280,34 +2288,32 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let nameArg = try! pigeonDelegate.name(pigeonApi: self, pigeonInstance: pigeonInstance) - let bodyArg = try! pigeonDelegate.body(pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessage.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, nameArg, bodyArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let nameArg = try! pigeonDelegate.name(pigeonApi: self, pigeonInstance: pigeonInstance) + let bodyArg = try! pigeonDelegate.body(pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessage.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, nameArg, bodyArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2350,37 +2356,35 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let hostArg = try! pigeonDelegate.host(pigeonApi: self, pigeonInstance: pigeonInstance) - let portArg = try! pigeonDelegate.port(pigeonApi: self, pigeonInstance: pigeonInstance) - let securityProtocolArg = try! pigeonDelegate.securityProtocol( - pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKSecurityOrigin.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, hostArg, portArg, securityProtocolArg] as [Any?]) { - response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let hostArg = try! pigeonDelegate.host(pigeonApi: self, pigeonInstance: pigeonInstance) + let portArg = try! pigeonDelegate.port(pigeonApi: self, pigeonInstance: pigeonInstance) + let securityProtocolArg = try! pigeonDelegate.securityProtocol( + pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKSecurityOrigin.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, hostArg, portArg, securityProtocolArg] as [Any?]) { + response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2470,32 +2474,30 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2578,37 +2580,35 @@ final class PigeonApiAuthenticationChallengeResponse: PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let dispositionArg = try! pigeonDelegate.disposition( - pigeonApi: self, pigeonInstance: pigeonInstance) - let credentialArg = try! pigeonDelegate.credential( - pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg, dispositionArg, credentialArg] as [Any?]) { - response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let dispositionArg = try! pigeonDelegate.disposition( + pigeonApi: self, pigeonInstance: pigeonInstance) + let credentialArg = try! pigeonDelegate.credential( + pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg, dispositionArg, credentialArg] as [Any?]) { + response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2729,32 +2729,30 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -2848,32 +2846,30 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -3173,32 +3169,30 @@ final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -3249,6 +3243,11 @@ protocol PigeonApiDelegateWKWebViewConfiguration { func setMediaTypesRequiringUserActionForPlayback( pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, type: AudiovisualMediaType) throws + /// The default preferences to use when loading and rendering content. + @available(iOS 13.0.0, macOS 10.15.0, *) + func getDefaultWebpagePreferences( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKWebpagePreferences } protocol PigeonApiProtocolWKWebViewConfiguration { @@ -3473,6 +3472,46 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setMediaTypesRequiringUserActionForPlaybackChannel.setMessageHandler(nil) } + if #available(iOS 13.0.0, macOS 10.15.0, *) { + let getDefaultWebpagePreferencesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getDefaultWebpagePreferences", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getDefaultWebpagePreferencesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebViewConfiguration + do { + let result = try api.pigeonDelegate.getDefaultWebpagePreferences( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + getDefaultWebpagePreferencesChannel.setMessageHandler(nil) + } + } else { + let getDefaultWebpagePreferencesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getDefaultWebpagePreferences", + binaryMessenger: binaryMessenger, codec: codec) + if api != nil { + getDefaultWebpagePreferencesChannel.setMessageHandler { message, reply in + reply( + wrapError( + FlutterError( + code: "PigeonUnsupportedOperationError", + message: + "Call to getDefaultWebpagePreferences requires @available(iOS 13.0.0, macOS 10.15.0, *).", + details: nil + ))) + } + } else { + getDefaultWebpagePreferencesChannel.setMessageHandler(nil) + } + } } ///Creates a Dart instance of WKWebViewConfiguration and attaches it to [pigeonInstance]. @@ -3486,32 +3525,30 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -3677,32 +3714,30 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -3770,32 +3805,30 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -3870,15 +3903,17 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + completion( + .failure( + PigeonError( + code: "new-instance-error", + message: + "Error: Attempting to create a new Dart instance of WKScriptMessageHandler, but the class has a nonnull callback method.", + details: ""))) } - print( - "Error: Attempting to create a new Dart instance of WKScriptMessageHandler, but the class has a nonnull callback method." - ) } /// Tells the handler that a webpage sent a script message. func didReceiveScriptMessage( @@ -3911,7 +3946,7 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -4019,33 +4054,16 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + completion( + .failure( + PigeonError( + code: "new-instance-error", + message: + "Error: Attempting to create a new Dart instance of WKNavigationDelegate, but the class has a nonnull callback method.", + details: ""))) } } /// Tells the delegate that navigation is complete. @@ -4078,7 +4096,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -4113,7 +4131,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -4238,7 +4256,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -4274,7 +4292,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -4309,7 +4327,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -4471,32 +4489,30 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -4532,7 +4548,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -5164,32 +5180,30 @@ final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -5794,32 +5808,30 @@ final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -5854,32 +5866,30 @@ final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebView.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebView.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -5972,33 +5982,16 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) - } + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + completion( + .failure( + PigeonError( + code: "new-instance-error", + message: + "Error: Attempting to create a new Dart instance of WKUIDelegate, but the class has a nonnull callback method.", + details: ""))) } } /// Creates a new web view. @@ -6035,7 +6028,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -6117,7 +6110,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -6275,32 +6268,30 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -6387,32 +6378,30 @@ final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -6453,7 +6442,7 @@ final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { - completion(.success(Void())) + completion(.success(())) } } } @@ -6530,32 +6519,30 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -6604,39 +6591,37 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let hostArg = try! pigeonDelegate.host(pigeonApi: self, pigeonInstance: pigeonInstance) - let portArg = try! pigeonDelegate.port(pigeonApi: self, pigeonInstance: pigeonInstance) - let realmArg = try! pigeonDelegate.realm(pigeonApi: self, pigeonInstance: pigeonInstance) - let authenticationMethodArg = try! pigeonDelegate.authenticationMethod( - pigeonApi: self, pigeonInstance: pigeonInstance) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [pigeonIdentifierArg, hostArg, portArg, realmArg, authenticationMethodArg] as [Any?] - ) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let hostArg = try! pigeonDelegate.host(pigeonApi: self, pigeonInstance: pigeonInstance) + let portArg = try! pigeonDelegate.port(pigeonApi: self, pigeonInstance: pigeonInstance) + let realmArg = try! pigeonDelegate.realm(pigeonApi: self, pigeonInstance: pigeonInstance) + let authenticationMethodArg = try! pigeonDelegate.authenticationMethod( + pigeonApi: self, pigeonInstance: pigeonInstance) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [pigeonIdentifierArg, hostArg, portArg, realmArg, authenticationMethodArg] as [Any?] + ) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -6707,32 +6692,30 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return - } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return - } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) - } else { - completion(.success(Void())) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } @@ -6794,31 +6777,148 @@ final class PigeonApiURL: PigeonApiProtocolURL { PigeonError( code: "ignore-calls-error", message: "Calls to Dart are being ignored.", details: ""))) - return - } - if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { - completion(.success(Void())) - return + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.URL.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } + } } - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.URL.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in - guard let listResponse = response as? [Any?] else { - completion(.failure(createConnectionError(withChannelName: channelName))) - return + } +} +protocol PigeonApiDelegateWKWebpagePreferences { + /// A Boolean value that indicates whether JavaScript from web content is + /// allowed to run. + @available(iOS 13.0.0, macOS 10.15.0, *) + func setAllowsContentJavaScript( + pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) + throws +} + +protocol PigeonApiProtocolWKWebpagePreferences { +} + +final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { + unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar + let pigeonDelegate: PigeonApiDelegateWKWebpagePreferences + ///An implementation of [NSObject] used to access callback methods + var pigeonApiNSObject: PigeonApiNSObject { + return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) + } + + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKWebpagePreferences + ) { + self.pigeonRegistrar = pigeonRegistrar + self.pigeonDelegate = delegate + } + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences? + ) { + let codec: FlutterStandardMessageCodec = + api != nil + ? FlutterStandardMessageCodec( + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) + : FlutterStandardMessageCodec.sharedInstance() + if #available(iOS 13.0.0, macOS 10.15.0, *) { + let setAllowsContentJavaScriptChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.setAllowsContentJavaScript", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsContentJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebpagePreferences + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsContentJavaScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + setAllowsContentJavaScriptChannel.setMessageHandler(nil) } - if listResponse.count > 1 { - let code: String = listResponse[0] as! String - let message: String? = nilOrValue(listResponse[1]) - let details: String? = nilOrValue(listResponse[2]) - completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + let setAllowsContentJavaScriptChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.setAllowsContentJavaScript", + binaryMessenger: binaryMessenger, codec: codec) + if api != nil { + setAllowsContentJavaScriptChannel.setMessageHandler { message, reply in + reply( + wrapError( + FlutterError( + code: "PigeonUnsupportedOperationError", + message: + "Call to setAllowsContentJavaScript requires @available(iOS 13.0.0, macOS 10.15.0, *).", + details: nil + ))) + } } else { - completion(.success(Void())) + setAllowsContentJavaScriptChannel.setMessageHandler(nil) + } + } + } + + ///Creates a Dart instance of WKWebpagePreferences and attaches it to [pigeonInstance]. + @available(iOS 13.0.0, macOS 10.15.0, *) + func pigeonNewInstance( + pigeonInstance: WKWebpagePreferences, completion: @escaping (Result) -> Void + ) { + if pigeonRegistrar.ignoreCallsToDart { + completion( + .failure( + PigeonError( + code: "ignore-calls-error", + message: "Calls to Dart are being ignored.", details: ""))) + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { + completion(.success(())) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonIdentifierArg] as [Any?]) { response in + guard let listResponse = response as? [Any?] else { + completion(.failure(createConnectionError(withChannelName: channelName))) + return + } + if listResponse.count > 1 { + let code: String = listResponse[0] as! String + let message: String? = nilOrValue(listResponse[1]) + let details: String? = nilOrValue(listResponse[2]) + completion(.failure(PigeonError(code: code, message: message, details: details))) + } else { + completion(.success(())) + } } } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewConfigurationProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewConfigurationProxyAPIDelegate.swift index ec509742fae..e6c6e85952a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewConfigurationProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebViewConfigurationProxyAPIDelegate.swift @@ -92,4 +92,11 @@ class WebViewConfigurationProxyAPIDelegate: PigeonApiDelegateWKWebViewConfigurat pigeonInstance.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypes.all } } + + @available(iOS 13.0, macOS 10.15, *) + func getDefaultWebpagePreferences( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKWebpagePreferences { + return pigeonInstance.defaultWebpagePreferences + } } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebpagePreferencesProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebpagePreferencesProxyAPIDelegate.swift new file mode 100644 index 00000000000..5c0721523c6 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/WebpagePreferencesProxyAPIDelegate.swift @@ -0,0 +1,25 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import WebKit + +/// ProxyApi implementation for `WKWebpagePreferences`. +/// +/// This class may handle instantiating native object instances that are attached to a Dart instance +/// or handle method calls on the associated native class or an instance of that class. +class WebpagePreferencesProxyAPIDelegate: PigeonApiDelegateWKWebpagePreferences { + @available(iOS 13.0, macOS 10.15, *) + func setAllowsContentJavaScript( + pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool + ) throws { + if #available(iOS 14.0, macOS 11.0, *) { + pigeonInstance.allowsContentJavaScript = allow + } else { + throw (pigeonApi.pigeonRegistrar as! ProxyAPIRegistrar) + .createUnsupportedVersionError( + method: "WKWebpagePreferences.allowsContentJavaScript", + versionRequirements: "iOS 14.0, macOS 11.0") + } + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj index 86c69e10969..8d55bed2605 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 60; objects = { /* Begin PBXBuildFile section */ @@ -40,6 +40,7 @@ 8F1488FE2D2DE27000191744 /* HTTPCookieProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F1488C82D2DE27000191744 /* HTTPCookieProxyAPITests.swift */; }; 8F1488FF2D2DE27000191744 /* NavigationActionProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F1488CB2D2DE27000191744 /* NavigationActionProxyAPITests.swift */; }; 8F1489012D2DE91C00191744 /* AuthenticationChallengeResponseProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F1489002D2DE91C00191744 /* AuthenticationChallengeResponseProxyAPITests.swift */; }; + 8FC45F712D5C0C1E004E03E8 /* WebpagePreferencesProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FC45F702D5C0C1E004E03E8 /* WebpagePreferencesProxyAPITests.swift */; }; 904EA421B6925EC8D52ABE1B /* libPods-RunnerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 573E8F1472CA1578A7CBDB63 /* libPods-RunnerTests.a */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; @@ -125,6 +126,7 @@ 8F1488E12D2DE27000191744 /* WebViewProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WebViewProxyAPITests.swift; path = ../../darwin/Tests/WebViewProxyAPITests.swift; sourceTree = SOURCE_ROOT; }; 8F1489002D2DE91C00191744 /* AuthenticationChallengeResponseProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AuthenticationChallengeResponseProxyAPITests.swift; path = ../../darwin/Tests/AuthenticationChallengeResponseProxyAPITests.swift; sourceTree = SOURCE_ROOT; }; 8F66D9D72D1362BE000835F9 /* RunnerTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RunnerTests-Bridging-Header.h"; sourceTree = ""; }; + 8FC45F702D5C0C1E004E03E8 /* WebpagePreferencesProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebpagePreferencesProxyAPITests.swift; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -170,6 +172,7 @@ 68BDCAEA23C3F7CB00D9C032 /* RunnerTests */ = { isa = PBXGroup; children = ( + 8FC45F702D5C0C1E004E03E8 /* WebpagePreferencesProxyAPITests.swift */, 8F1489002D2DE91C00191744 /* AuthenticationChallengeResponseProxyAPITests.swift */, 8F1488C52D2DE27000191744 /* ErrorProxyAPITests.swift */, 8F1488C62D2DE27000191744 /* FrameInfoProxyAPITests.swift */, @@ -395,7 +398,7 @@ ); mainGroup = 97C146E51CF9000F007C117D; packageReferences = ( - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; @@ -539,6 +542,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 8FC45F712D5C0C1E004E03E8 /* WebpagePreferencesProxyAPITests.swift in Sources */, 8F1488E22D2DE27000191744 /* ScriptMessageHandlerProxyAPITests.swift in Sources */, 8F1488E32D2DE27000191744 /* TestProxyApiRegistrar.swift in Sources */, 8F1488E42D2DE27000191744 /* URLRequestProxyAPITests.swift in Sources */, @@ -918,7 +922,7 @@ /* End XCConfigurationList section */ /* Begin XCLocalSwiftPackageReference section */ - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { isa = XCLocalSwiftPackageReference; relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; }; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/WebpagePreferencesProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/WebpagePreferencesProxyAPITests.swift new file mode 100644 index 00000000000..aa11b48ad1e --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/WebpagePreferencesProxyAPITests.swift @@ -0,0 +1,23 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import WebKit +import XCTest + +@testable import webview_flutter_wkwebview + +class WebpagePreferencesProxyAPITests: XCTestCase { + @available(iOS 14.0, macOS 11.0, *) + @MainActor func testSetAllowsContentJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebpagePreferences(registrar) + + let instance = WKWebpagePreferences() + let allow = true + try? api.pigeonDelegate.setAllowsContentJavaScript( + pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.allowsContentJavaScript, allow) + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/macos/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/macos/Runner.xcodeproj/project.pbxproj index d8799f08111..4fb9e94bb55 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/macos/Runner.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 6FBECA2F94D9B352000B75D7 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 418FB4EA49104BADE288A967 /* Pods_RunnerTests.framework */; }; 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; + 8FC45F732D5C0C37004E03E8 /* WebpagePreferencesProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FC45F722D5C0C37004E03E8 /* WebpagePreferencesProxyAPITests.swift */; }; 8FF1FEA22D37201300A5E400 /* NSObjectProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FF1FE8E2D37201300A5E400 /* NSObjectProxyAPITests.swift */; }; 8FF1FEA32D37201300A5E400 /* ScrollViewProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FF1FE932D37201300A5E400 /* ScrollViewProxyAPITests.swift */; }; 8FF1FEA42D37201300A5E400 /* URLAuthenticationChallengeProxyAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FF1FE992D37201300A5E400 /* URLAuthenticationChallengeProxyAPITests.swift */; }; @@ -112,6 +113,7 @@ 69E635CFAEEB8242654D4BBC /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 7D83F970E1160B09690C7723 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 8FC45F722D5C0C37004E03E8 /* WebpagePreferencesProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebpagePreferencesProxyAPITests.swift; sourceTree = ""; }; 8FF1FE842D37201300A5E400 /* AuthenticationChallengeResponseProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AuthenticationChallengeResponseProxyAPITests.swift; path = ../../darwin/Tests/AuthenticationChallengeResponseProxyAPITests.swift; sourceTree = SOURCE_ROOT; }; 8FF1FE852D37201300A5E400 /* ErrorProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ErrorProxyAPITests.swift; path = ../../darwin/Tests/ErrorProxyAPITests.swift; sourceTree = SOURCE_ROOT; }; 8FF1FE862D37201300A5E400 /* FrameInfoProxyAPITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = FrameInfoProxyAPITests.swift; path = ../../darwin/Tests/FrameInfoProxyAPITests.swift; sourceTree = SOURCE_ROOT; }; @@ -174,6 +176,7 @@ 331C80D6294CF71000263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( + 8FC45F722D5C0C37004E03E8 /* WebpagePreferencesProxyAPITests.swift */, 8FF1FE842D37201300A5E400 /* AuthenticationChallengeResponseProxyAPITests.swift */, 8FF1FE852D37201300A5E400 /* ErrorProxyAPITests.swift */, 8FF1FE862D37201300A5E400 /* FrameInfoProxyAPITests.swift */, @@ -525,6 +528,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 8FC45F732D5C0C37004E03E8 /* WebpagePreferencesProxyAPITests.swift in Sources */, 8FF1FEA22D37201300A5E400 /* NSObjectProxyAPITests.swift in Sources */, 8FF1FEA32D37201300A5E400 /* ScrollViewProxyAPITests.swift in Sources */, 8FF1FEA42D37201300A5E400 /* URLAuthenticationChallengeProxyAPITests.swift in Sources */, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/macos/RunnerTests/WebpagePreferencesProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/example/macos/RunnerTests/WebpagePreferencesProxyAPITests.swift new file mode 100644 index 00000000000..aa11b48ad1e --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/macos/RunnerTests/WebpagePreferencesProxyAPITests.swift @@ -0,0 +1,23 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import WebKit +import XCTest + +@testable import webview_flutter_wkwebview + +class WebpagePreferencesProxyAPITests: XCTestCase { + @available(iOS 14.0, macOS 11.0, *) + @MainActor func testSetAllowsContentJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebpagePreferences(registrar) + + let instance = WKWebpagePreferences() + let allow = true + try? api.pigeonDelegate.setAllowsContentJavaScript( + pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.allowsContentJavaScript, allow) + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart index 78a7a5d9300..888b6393467 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v22.7.2), do not edit directly. +// Autogenerated from Pigeon (v24.1.1), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -197,6 +197,8 @@ class PigeonInstanceManager { URLAuthenticationChallenge.pigeon_setUpMessageHandlers( pigeon_instanceManager: instanceManager); URL.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebpagePreferences.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -3466,6 +3468,39 @@ class WKWebViewConfiguration extends NSObject { } } + /// The default preferences to use when loading and rendering content. + Future getDefaultWebpagePreferences() async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecWKWebViewConfiguration; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getDefaultWebpagePreferences'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else if (pigeonVar_replyList[0] == null) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } else { + return (pigeonVar_replyList[0] as WKWebpagePreferences?)!; + } + } + @override WKWebViewConfiguration pigeon_copy() { return WKWebViewConfiguration.pigeon_detached( @@ -3963,12 +3998,12 @@ class WKNavigationDelegate extends NSObject { super.observeValue, this.didFinishNavigation, this.didStartProvisionalNavigation, - this.decidePolicyForNavigationAction, - this.decidePolicyForNavigationResponse, + required this.decidePolicyForNavigationAction, + required this.decidePolicyForNavigationResponse, this.didFailNavigation, this.didFailProvisionalNavigation, this.webViewWebContentProcessDidTerminate, - this.didReceiveAuthenticationChallenge, + required this.didReceiveAuthenticationChallenge, }) : super.pigeon_detached() { final int pigeonVar_instanceIdentifier = pigeon_instanceManager.addDartCreatedInstance(this); @@ -4011,12 +4046,12 @@ class WKNavigationDelegate extends NSObject { super.observeValue, this.didFinishNavigation, this.didStartProvisionalNavigation, - this.decidePolicyForNavigationAction, - this.decidePolicyForNavigationResponse, + required this.decidePolicyForNavigationAction, + required this.decidePolicyForNavigationResponse, this.didFailNavigation, this.didFailProvisionalNavigation, this.webViewWebContentProcessDidTerminate, - this.didReceiveAuthenticationChallenge, + required this.didReceiveAuthenticationChallenge, }) : super.pigeon_detached(); late final _PigeonInternalProxyApiBaseCodec @@ -4097,7 +4132,7 @@ class WKNavigationDelegate extends NSObject { WKNavigationDelegate pigeon_instance, WKWebView webView, WKNavigationAction navigationAction, - )? decidePolicyForNavigationAction; + ) decidePolicyForNavigationAction; /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. @@ -4123,7 +4158,7 @@ class WKNavigationDelegate extends NSObject { WKNavigationDelegate pigeon_instance, WKWebView webView, WKNavigationResponse navigationResponse, - )? decidePolicyForNavigationResponse; + ) decidePolicyForNavigationResponse; /// Tells the delegate that an error occurred during navigation. /// @@ -4223,13 +4258,12 @@ class WKNavigationDelegate extends NSObject { WKNavigationDelegate pigeon_instance, WKWebView webView, URLAuthenticationChallenge challenge, - )? didReceiveAuthenticationChallenge; + ) didReceiveAuthenticationChallenge; static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, - WKNavigationDelegate Function()? pigeon_newInstance, void Function( WKNavigationDelegate pigeon_instance, WKWebView webView, @@ -4274,44 +4308,6 @@ class WKNavigationDelegate extends NSObject { _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_newInstance', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (pigeon_clearHandlers) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_newInstance was null.'); - final List args = (message as List?)!; - final int? arg_pigeon_instanceIdentifier = (args[0] as int?); - assert(arg_pigeon_instanceIdentifier != null, - 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_newInstance was null, expected non-null int.'); - try { - (pigeon_instanceManager ?? PigeonInstanceManager.instance) - .addHostCreatedInstance( - pigeon_newInstance?.call() ?? - WKNavigationDelegate.pigeon_detached( - pigeon_binaryMessenger: pigeon_binaryMessenger, - pigeon_instanceManager: pigeon_instanceManager, - ), - arg_pigeon_instanceIdentifier!, - ); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { final BasicMessageChannel< Object?> pigeonVar_channel = BasicMessageChannel< @@ -4411,10 +4407,10 @@ class WKNavigationDelegate extends NSObject { assert(arg_navigationAction != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction was null, expected non-null WKNavigationAction.'); try { - final NavigationActionPolicy? output = + final NavigationActionPolicy output = await (decidePolicyForNavigationAction ?? arg_pigeon_instance!.decidePolicyForNavigationAction) - ?.call(arg_pigeon_instance!, arg_webView!, + .call(arg_pigeon_instance!, arg_webView!, arg_navigationAction!); return wrapResponse(result: output); } on PlatformException catch (e) { @@ -4453,10 +4449,10 @@ class WKNavigationDelegate extends NSObject { assert(arg_navigationResponse != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse was null, expected non-null WKNavigationResponse.'); try { - final NavigationResponsePolicy? output = + final NavigationResponsePolicy output = await (decidePolicyForNavigationResponse ?? arg_pigeon_instance!.decidePolicyForNavigationResponse) - ?.call(arg_pigeon_instance!, arg_webView!, + .call(arg_pigeon_instance!, arg_webView!, arg_navigationResponse!); return wrapResponse(result: output); } on PlatformException catch (e) { @@ -4608,10 +4604,10 @@ class WKNavigationDelegate extends NSObject { assert(arg_challenge != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge was null, expected non-null URLAuthenticationChallenge.'); try { - final AuthenticationChallengeResponse? output = + final AuthenticationChallengeResponse output = await (didReceiveAuthenticationChallenge ?? arg_pigeon_instance!.didReceiveAuthenticationChallenge) - ?.call(arg_pigeon_instance!, arg_webView!, arg_challenge!); + .call(arg_pigeon_instance!, arg_webView!, arg_challenge!); return wrapResponse(result: output); } on PlatformException catch (e) { return wrapResponse(error: e); @@ -6447,9 +6443,9 @@ class WKUIDelegate extends NSObject { super.pigeon_instanceManager, super.observeValue, this.onCreateWebView, - this.requestMediaCapturePermission, + required this.requestMediaCapturePermission, this.runJavaScriptAlertPanel, - this.runJavaScriptConfirmPanel, + required this.runJavaScriptConfirmPanel, this.runJavaScriptTextInputPanel, }) : super.pigeon_detached() { final int pigeonVar_instanceIdentifier = @@ -6492,9 +6488,9 @@ class WKUIDelegate extends NSObject { super.pigeon_instanceManager, super.observeValue, this.onCreateWebView, - this.requestMediaCapturePermission, + required this.requestMediaCapturePermission, this.runJavaScriptAlertPanel, - this.runJavaScriptConfirmPanel, + required this.runJavaScriptConfirmPanel, this.runJavaScriptTextInputPanel, }) : super.pigeon_detached(); @@ -6553,7 +6549,7 @@ class WKUIDelegate extends NSObject { WKSecurityOrigin origin, WKFrameInfo frame, MediaCaptureType type, - )? requestMediaCapturePermission; + ) requestMediaCapturePermission; /// Displays a JavaScript alert panel. /// @@ -6605,7 +6601,7 @@ class WKUIDelegate extends NSObject { WKWebView webView, String message, WKFrameInfo frame, - )? runJavaScriptConfirmPanel; + ) runJavaScriptConfirmPanel; /// Displays a JavaScript text input panel. /// @@ -6638,7 +6634,6 @@ class WKUIDelegate extends NSObject { bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, - WKUIDelegate Function()? pigeon_newInstance, void Function( WKUIDelegate pigeon_instance, WKWebView webView, @@ -6676,44 +6671,6 @@ class WKUIDelegate extends NSObject { _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; - { - final BasicMessageChannel< - Object?> pigeonVar_channel = BasicMessageChannel< - Object?>( - 'dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_newInstance', - pigeonChannelCodec, - binaryMessenger: binaryMessenger); - if (pigeon_clearHandlers) { - pigeonVar_channel.setMessageHandler(null); - } else { - pigeonVar_channel.setMessageHandler((Object? message) async { - assert(message != null, - 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_newInstance was null.'); - final List args = (message as List?)!; - final int? arg_pigeon_instanceIdentifier = (args[0] as int?); - assert(arg_pigeon_instanceIdentifier != null, - 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_newInstance was null, expected non-null int.'); - try { - (pigeon_instanceManager ?? PigeonInstanceManager.instance) - .addHostCreatedInstance( - pigeon_newInstance?.call() ?? - WKUIDelegate.pigeon_detached( - pigeon_binaryMessenger: pigeon_binaryMessenger, - pigeon_instanceManager: pigeon_instanceManager, - ), - arg_pigeon_instanceIdentifier!, - ); - return wrapResponse(empty: true); - } on PlatformException catch (e) { - return wrapResponse(error: e); - } catch (e) { - return wrapResponse( - error: PlatformException(code: 'error', message: e.toString())); - } - }); - } - } - { final BasicMessageChannel< Object?> pigeonVar_channel = BasicMessageChannel< @@ -6789,10 +6746,10 @@ class WKUIDelegate extends NSObject { assert(arg_type != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission was null, expected non-null MediaCaptureType.'); try { - final PermissionDecision? output = + final PermissionDecision output = await (requestMediaCapturePermission ?? arg_pigeon_instance!.requestMediaCapturePermission) - ?.call(arg_pigeon_instance!, arg_webView!, arg_origin!, + .call(arg_pigeon_instance!, arg_webView!, arg_origin!, arg_frame!, arg_type!); return wrapResponse(result: output); } on PlatformException catch (e) { @@ -6874,9 +6831,9 @@ class WKUIDelegate extends NSObject { assert(arg_frame != null, 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel was null, expected non-null WKFrameInfo.'); try { - final bool? output = await (runJavaScriptConfirmPanel ?? + final bool output = await (runJavaScriptConfirmPanel ?? arg_pigeon_instance!.runJavaScriptConfirmPanel) - ?.call(arg_pigeon_instance!, arg_webView!, arg_message!, + .call(arg_pigeon_instance!, arg_webView!, arg_message!, arg_frame!); return wrapResponse(result: output); } on PlatformException catch (e) { @@ -7597,7 +7554,7 @@ class URLAuthenticationChallenge extends NSObject { } /// A value that identifies the location of a resource, such as an item on a -/// remote server or the path to a local file.. +/// remote server or the path to a local file. /// /// See https://developer.apple.com/documentation/foundation/url. class URL extends NSObject { @@ -7706,3 +7663,111 @@ class URL extends NSObject { ); } } + +/// An object that specifies the behaviors to use when loading and rendering +/// page content. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebpagepreferences. +class WKWebpagePreferences extends NSObject { + /// Constructs [WKWebpagePreferences] without creating the associated native object. + /// + /// This should only be used by subclasses created by this library or to + /// create copies for an [PigeonInstanceManager]. + @protected + WKWebpagePreferences.pigeon_detached({ + super.pigeon_binaryMessenger, + super.pigeon_instanceManager, + super.observeValue, + }) : super.pigeon_detached(); + + late final _PigeonInternalProxyApiBaseCodec + _pigeonVar_codecWKWebpagePreferences = + _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); + + static void pigeon_setUpMessageHandlers({ + bool pigeon_clearHandlers = false, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + WKWebpagePreferences Function()? pigeon_newInstance, + }) { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInstanceManager.instance); + final BinaryMessenger? binaryMessenger = pigeon_binaryMessenger; + { + final BasicMessageChannel< + Object?> pigeonVar_channel = BasicMessageChannel< + Object?>( + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.pigeon_newInstance', + pigeonChannelCodec, + binaryMessenger: binaryMessenger); + if (pigeon_clearHandlers) { + pigeonVar_channel.setMessageHandler(null); + } else { + pigeonVar_channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.pigeon_newInstance was null.'); + final List args = (message as List?)!; + final int? arg_pigeon_instanceIdentifier = (args[0] as int?); + assert(arg_pigeon_instanceIdentifier != null, + 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.pigeon_newInstance was null, expected non-null int.'); + try { + (pigeon_instanceManager ?? PigeonInstanceManager.instance) + .addHostCreatedInstance( + pigeon_newInstance?.call() ?? + WKWebpagePreferences.pigeon_detached( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + ), + arg_pigeon_instanceIdentifier!, + ); + return wrapResponse(empty: true); + } on PlatformException catch (e) { + return wrapResponse(error: e); + } catch (e) { + return wrapResponse( + error: PlatformException(code: 'error', message: e.toString())); + } + }); + } + } + } + + /// A Boolean value that indicates whether JavaScript from web content is + /// allowed to run. + Future setAllowsContentJavaScript(bool allow) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecWKWebpagePreferences; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.setAllowsContentJavaScript'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final List? pigeonVar_replyList = + await pigeonVar_channel.send([this, allow]) as List?; + if (pigeonVar_replyList == null) { + throw _createConnectionError(pigeonVar_channelName); + } else if (pigeonVar_replyList.length > 1) { + throw PlatformException( + code: pigeonVar_replyList[0]! as String, + message: pigeonVar_replyList[1] as String?, + details: pigeonVar_replyList[2], + ); + } else { + return; + } + } + + @override + WKWebpagePreferences pigeon_copy() { + return WKWebpagePreferences.pigeon_detached( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/legacy/web_kit_webview_widget.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/legacy/web_kit_webview_widget.dart index d347ce077bc..3caec799cfe 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/legacy/web_kit_webview_widget.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/legacy/web_kit_webview_widget.dart @@ -510,6 +510,25 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { } Future _setJavaScriptMode(JavascriptMode mode) async { + // Attempt to set the value that requires iOS 14+. + try { + final WKWebpagePreferences webpagePreferences = + await webView.configuration.getDefaultWebpagePreferences(); + switch (mode) { + case JavascriptMode.disabled: + await webpagePreferences.setAllowsContentJavaScript(false); + case JavascriptMode.unrestricted: + await webpagePreferences.setAllowsContentJavaScript(true); + } + return; + } on PlatformException catch (exception) { + if (exception.code != 'PigeonUnsupportedOperationError') { + rethrow; + } + } catch (exception) { + rethrow; + } + final WKPreferences preferences = await webView.configuration.getPreferences(); switch (mode) { @@ -699,7 +718,15 @@ class WebViewWidgetProxy { WKNavigationAction navigationAction, )? onCreateWebView, }) { - return WKUIDelegate(onCreateWebView: onCreateWebView); + return WKUIDelegate( + onCreateWebView: onCreateWebView, + requestMediaCapturePermission: (_, __, ___, ____, _____) async { + return PermissionDecision.deny; + }, + runJavaScriptConfirmPanel: (_, __, ___, ____) async { + return false; + }, + ); } /// Constructs a [WKNavigationDelegate]. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_proxy.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_proxy.dart index 5c3638bd04c..d60dedf3aa0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_proxy.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_proxy.dart @@ -78,16 +78,16 @@ class WebKitProxy { WKWebView, String?, )? didStartProvisionalNavigation, - Future Function( + required Future Function( WKNavigationDelegate, WKWebView, WKNavigationAction, - )? decidePolicyForNavigationAction, - Future Function( + ) decidePolicyForNavigationAction, + required Future Function( WKNavigationDelegate, WKWebView, WKNavigationResponse, - )? decidePolicyForNavigationResponse, + ) decidePolicyForNavigationResponse, void Function( WKNavigationDelegate, WKWebView, @@ -102,11 +102,11 @@ class WebKitProxy { WKNavigationDelegate, WKWebView, )? webViewWebContentProcessDidTerminate, - Future Function( + required Future Function( WKNavigationDelegate, WKWebView, URLAuthenticationChallenge, - )? didReceiveAuthenticationChallenge, + ) didReceiveAuthenticationChallenge, }) newWKNavigationDelegate; /// Constructs [NSObject]. @@ -137,25 +137,25 @@ class WebKitProxy { WKWebViewConfiguration, WKNavigationAction, )? onCreateWebView, - Future Function( + required Future Function( WKUIDelegate, WKWebView, WKSecurityOrigin, WKFrameInfo, MediaCaptureType, - )? requestMediaCapturePermission, + ) requestMediaCapturePermission, Future Function( WKUIDelegate, WKWebView, String, WKFrameInfo, )? runJavaScriptAlertPanel, - Future Function( + required Future Function( WKUIDelegate, WKWebView, String, WKFrameInfo, - )? runJavaScriptConfirmPanel, + ) runJavaScriptConfirmPanel, Future Function( WKUIDelegate, WKWebView, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart index 3856964326d..cc04cb83c98 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart @@ -564,6 +564,25 @@ class WebKitWebViewController extends PlatformWebViewController { @override Future setJavaScriptMode(JavaScriptMode javaScriptMode) async { + // Attempt to set the value that requires iOS 14+. + try { + final WKWebpagePreferences webpagePreferences = + await _webView.configuration.getDefaultWebpagePreferences(); + switch (javaScriptMode) { + case JavaScriptMode.disabled: + await webpagePreferences.setAllowsContentJavaScript(false); + case JavaScriptMode.unrestricted: + await webpagePreferences.setAllowsContentJavaScript(true); + } + return; + } on PlatformException catch (exception) { + if (exception.code != 'PigeonUnsupportedOperationError') { + rethrow; + } + } catch (exception) { + rethrow; + } + final WKPreferences preferences = await _webView.configuration.getPreferences(); switch (javaScriptMode) { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart index b1240625837..dd247f24762 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -650,6 +650,9 @@ abstract class WKWebViewConfiguration extends NSObject { /// The media types that require a user gesture to begin playing. void setMediaTypesRequiringUserActionForPlayback(AudiovisualMediaType type); + + /// The default preferences to use when loading and rendering content. + WKWebpagePreferences getDefaultWebpagePreferences(); } /// An object for managing interactions between JavaScript code and your web @@ -719,18 +722,18 @@ abstract class WKNavigationDelegate extends NSObject { /// Asks the delegate for permission to navigate to new content based on the /// specified action information. @async - NavigationActionPolicy Function( + late NavigationActionPolicy Function( WKWebView webView, WKNavigationAction navigationAction, - )? decidePolicyForNavigationAction; + ) decidePolicyForNavigationAction; /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. @async - NavigationResponsePolicy Function( + late NavigationResponsePolicy Function( WKWebView webView, WKNavigationResponse navigationResponse, - )? decidePolicyForNavigationResponse; + ) decidePolicyForNavigationResponse; /// Tells the delegate that an error occurred during navigation. void Function(WKWebView webView, NSError error)? didFailNavigation; @@ -744,10 +747,10 @@ abstract class WKNavigationDelegate extends NSObject { /// Asks the delegate to respond to an authentication challenge. @async - AuthenticationChallengeResponse Function( + late AuthenticationChallengeResponse Function( WKWebView webView, URLAuthenticationChallenge challenge, - )? didReceiveAuthenticationChallenge; + ) didReceiveAuthenticationChallenge; } /// The root class of most Objective-C class hierarchies, from which subclasses @@ -981,12 +984,12 @@ abstract class WKUIDelegate extends NSObject { /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. @async - PermissionDecision Function( + late PermissionDecision Function( WKWebView webView, WKSecurityOrigin origin, WKFrameInfo frame, MediaCaptureType type, - )? requestMediaCapturePermission; + ) requestMediaCapturePermission; /// Displays a JavaScript alert panel. @async @@ -998,11 +1001,11 @@ abstract class WKUIDelegate extends NSObject { /// Displays a JavaScript confirm panel. @async - bool Function( + late bool Function( WKWebView webView, String message, WKFrameInfo frame, - )? runJavaScriptConfirmPanel; + ) runJavaScriptConfirmPanel; /// Displays a JavaScript text input panel. @async @@ -1091,7 +1094,7 @@ abstract class URLAuthenticationChallenge extends NSObject { } /// A value that identifies the location of a resource, such as an item on a -/// remote server or the path to a local file.. +/// remote server or the path to a local file. /// /// See https://developer.apple.com/documentation/foundation/url. @ProxyApi(swiftOptions: SwiftProxyApiOptions(name: 'URL')) @@ -1099,3 +1102,20 @@ abstract class URL extends NSObject { /// The absolute string for the URL. String getAbsoluteString(); } + +/// An object that specifies the behaviors to use when loading and rendering +/// page content. +/// +/// See https://developer.apple.com/documentation/webkit/wkwebpagepreferences. +@ProxyApi( + swiftOptions: SwiftProxyApiOptions( + import: 'WebKit', + minIosApi: '13.0.0', + minMacosApi: '10.15.0', + ), +) +abstract class WKWebpagePreferences extends NSObject { + /// A Boolean value that indicates whether JavaScript from web content is + /// allowed to run. + void setAllowsContentJavaScript(bool allow); +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index efb1fb149d8..00e0feb057d 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control. repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22 -version: 3.18.0 +version: 3.18.1 environment: sdk: ^3.5.0 @@ -32,7 +32,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^22.7.2 + pigeon: ^24.1.1 topics: - html diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.mocks.dart index 887a7152dec..4e7d186e80f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.dart. // Do not manually edit this file. @@ -16,6 +16,7 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -23,35 +24,20 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; class _FakePigeonInstanceManager_0 extends _i1.SmartFake implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePigeonInstanceManager_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKHTTPCookieStore_1 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { - _FakeWKHTTPCookieStore_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKHTTPCookieStore_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_2 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { - _FakeWKWebsiteDataStore_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebsiteDataStore_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [WKHTTPCookieStore]. @@ -73,26 +59,17 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { @override _i3.Future setCookie(_i2.HTTPCookie? cookie) => (super.noSuchMethod( - Invocation.method( - #setCookie, - [cookie], - ), + Invocation.method(#setCookie, [cookie]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.WKHTTPCookieStore pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKHTTPCookieStore_1( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKHTTPCookieStore); @@ -103,31 +80,15 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -162,16 +123,10 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), + Invocation.method(#pigeonVar_httpCookieStore, []), returnValue: _FakeWKHTTPCookieStore_1( this, - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), + Invocation.method(#pigeonVar_httpCookieStore, []), ), ) as _i2.WKHTTPCookieStore); @@ -181,28 +136,19 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method( - #removeDataOfTypes, - [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ], - ), + Invocation.method(#removeDataOfTypes, [ + dataTypes, + modificationTimeInSecondsSinceEpoch, + ]), returnValue: _i3.Future.value(false), ) as _i3.Future); @override _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKWebsiteDataStore_2( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebsiteDataStore); @@ -213,31 +159,15 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart index 6b0e8816a9f..934889e3b84 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart @@ -33,6 +33,7 @@ import 'web_kit_webview_widget_test.mocks.dart'; JavascriptChannelRegistry, WebViewPlatformCallbacksHandler, WebViewWidgetProxy, + WKWebpagePreferences, ]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -50,7 +51,8 @@ void main() { websiteDataStore: MockWKWebsiteDataStore(), navigationDelegate: MockWKNavigationDelegate(), callbacksHandler: MockWebViewPlatformCallbacksHandler(), - javascriptChannelRegistry: MockJavascriptChannelRegistry()); + javascriptChannelRegistry: MockJavascriptChannelRegistry(), + webpagePreferences: MockWKWebpagePreferences()); when( mocks.webViewWidgetProxy.createWebView( @@ -86,6 +88,9 @@ void main() { ); when(mocks.webViewConfiguration.getPreferences()) .thenAnswer((_) => Future.value(mocks.preferences)); + when(mocks.webViewConfiguration.getDefaultWebpagePreferences()) + .thenAnswer((_) => + Future.value(mocks.webpagePreferences)); when(mocks.webView.scrollView).thenReturn(mocks.scrollView); @@ -331,7 +336,7 @@ void main() { ), ); - verify(mocks.preferences.setJavaScriptEnabled(true)); + verify(mocks.webpagePreferences.setAllowsContentJavaScript(true)); }); testWidgets('userAgent', (WidgetTester tester) async { @@ -1498,6 +1503,7 @@ class _WebViewMocks { required this.navigationDelegate, required this.callbacksHandler, required this.javascriptChannelRegistry, + required this.webpagePreferences, }); final MockUIViewWKWebView webView; @@ -1511,6 +1517,7 @@ class _WebViewMocks { final MockWKNavigationDelegate navigationDelegate; final MockWebViewPlatformCallbacksHandler callbacksHandler; final MockJavascriptChannelRegistry javascriptChannelRegistry; + final MockWKWebpagePreferences webpagePreferences; } // Test InstanceManager that sets `onWeakReferenceRemoved` as a noop. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart index db74eb20358..58aa23e918a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart. // Do not manually edit this file. @@ -27,6 +27,7 @@ import 'package:webview_flutter_wkwebview/src/legacy/web_kit_webview_widget.dart // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -34,151 +35,95 @@ import 'package:webview_flutter_wkwebview/src/legacy/web_kit_webview_widget.dart class _FakePigeonInstanceManager_0 extends _i1.SmartFake implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePigeonInstanceManager_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUIScrollView_1 extends _i1.SmartFake implements _i2.UIScrollView { - _FakeUIScrollView_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeUIScrollView_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeURLRequest_2 extends _i1.SmartFake implements _i2.URLRequest { - _FakeURLRequest_2( + _FakeURLRequest_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeAuthenticationChallengeResponse_3 extends _i1.SmartFake + implements _i2.AuthenticationChallengeResponse { + _FakeAuthenticationChallengeResponse_3( Object parent, Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + ) : super(parent, parentInvocation); } -class _FakeWKNavigationDelegate_3 extends _i1.SmartFake +class _FakeWKNavigationDelegate_4 extends _i1.SmartFake implements _i2.WKNavigationDelegate { - _FakeWKNavigationDelegate_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKNavigationDelegate_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKPreferences_4 extends _i1.SmartFake implements _i2.WKPreferences { - _FakeWKPreferences_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); +class _FakeWKPreferences_5 extends _i1.SmartFake implements _i2.WKPreferences { + _FakeWKPreferences_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKScriptMessageHandler_5 extends _i1.SmartFake +class _FakeWKScriptMessageHandler_6 extends _i1.SmartFake implements _i2.WKScriptMessageHandler { - _FakeWKScriptMessageHandler_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKScriptMessageHandler_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKWebView_6 extends _i1.SmartFake implements _i2.WKWebView { - _FakeWKWebView_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); +class _FakeWKWebView_7 extends _i1.SmartFake implements _i2.WKWebView { + _FakeWKWebView_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKWebViewConfiguration_7 extends _i1.SmartFake +class _FakeWKWebViewConfiguration_8 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { - _FakeWKWebViewConfiguration_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebViewConfiguration_8(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeUIViewWKWebView_8 extends _i1.SmartFake +class _FakeUIViewWKWebView_9 extends _i1.SmartFake implements _i2.UIViewWKWebView { - _FakeUIViewWKWebView_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeUIViewWKWebView_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKUserContentController_9 extends _i1.SmartFake +class _FakeWKUserContentController_10 extends _i1.SmartFake implements _i2.WKUserContentController { - _FakeWKUserContentController_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKUserContentController_10(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKWebsiteDataStore_10 extends _i1.SmartFake +class _FakeWKWebsiteDataStore_11 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { - _FakeWKWebsiteDataStore_10( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebsiteDataStore_11(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeWKWebpagePreferences_12 extends _i1.SmartFake + implements _i2.WKWebpagePreferences { + _FakeWKWebpagePreferences_12(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKHTTPCookieStore_11 extends _i1.SmartFake +class _FakeWKHTTPCookieStore_13 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { - _FakeWKHTTPCookieStore_11( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKHTTPCookieStore_13(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKUIDelegate_12 extends _i1.SmartFake implements _i2.WKUIDelegate { - _FakeWKUIDelegate_12( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); +class _FakeWKUIDelegate_14 extends _i1.SmartFake implements _i2.WKUIDelegate { + _FakeWKUIDelegate_14(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakePlatformWebView_13 extends _i1.SmartFake +class _FakePlatformWebView_15 extends _i1.SmartFake implements _i3.PlatformWebView { - _FakePlatformWebView_13( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePlatformWebView_15(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [UIScrollView]. @@ -200,43 +145,21 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @override _i4.Future> getContentOffset() => (super.noSuchMethod( - Invocation.method( - #getContentOffset, - [], - ), + Invocation.method(#getContentOffset, []), returnValue: _i4.Future>.value([]), ) as _i4.Future>); @override - _i4.Future scrollBy( - double? x, - double? y, - ) => - (super.noSuchMethod( - Invocation.method( - #scrollBy, - [ - x, - y, - ], - ), + _i4.Future scrollBy(double? x, double? y) => (super.noSuchMethod( + Invocation.method(#scrollBy, [x, y]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future setContentOffset( - double? x, - double? y, - ) => + _i4.Future setContentOffset(double? x, double? y) => (super.noSuchMethod( - Invocation.method( - #setContentOffset, - [ - x, - y, - ], - ), + Invocation.method(#setContentOffset, [x, y]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -244,45 +167,66 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @override _i4.Future setDelegate(_i2.UIScrollViewDelegate? delegate) => (super.noSuchMethod( - Invocation.method( - #setDelegate, - [delegate], - ), + Invocation.method(#setDelegate, [delegate]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future setBounces(bool? value) => (super.noSuchMethod( + Invocation.method(#setBounces, [value]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future setBouncesHorizontally(bool? value) => (super.noSuchMethod( + Invocation.method(#setBouncesHorizontally, [value]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future setBouncesVertically(bool? value) => (super.noSuchMethod( + Invocation.method(#setBouncesVertically, [value]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future setAlwaysBounceVertical(bool? value) => (super.noSuchMethod( + Invocation.method(#setAlwaysBounceVertical, [value]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future setAlwaysBounceHorizontal(bool? value) => + (super.noSuchMethod( + Invocation.method(#setAlwaysBounceHorizontal, [value]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i2.UIScrollView pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeUIScrollView_1( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.UIScrollView); @override _i4.Future setBackgroundColor(int? value) => (super.noSuchMethod( - Invocation.method( - #setBackgroundColor, - [value], - ), + Invocation.method(#setBackgroundColor, [value]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setOpaque(bool? opaque) => (super.noSuchMethod( - Invocation.method( - #setOpaque, - [opaque], - ), + Invocation.method(#setOpaque, [opaque]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -294,31 +238,15 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -343,58 +271,40 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @override _i4.Future getUrl() => (super.noSuchMethod( - Invocation.method( - #getUrl, - [], - ), + Invocation.method(#getUrl, []), returnValue: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setHttpMethod(String? method) => (super.noSuchMethod( - Invocation.method( - #setHttpMethod, - [method], - ), + Invocation.method(#setHttpMethod, [method]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future getHttpMethod() => (super.noSuchMethod( - Invocation.method( - #getHttpMethod, - [], - ), + Invocation.method(#getHttpMethod, []), returnValue: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setHttpBody(_i5.Uint8List? body) => (super.noSuchMethod( - Invocation.method( - #setHttpBody, - [body], - ), + Invocation.method(#setHttpBody, [body]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future<_i5.Uint8List?> getHttpBody() => (super.noSuchMethod( - Invocation.method( - #getHttpBody, - [], - ), + Invocation.method(#getHttpBody, []), returnValue: _i4.Future<_i5.Uint8List?>.value(), ) as _i4.Future<_i5.Uint8List?>); @override _i4.Future setAllHttpHeaderFields(Map? fields) => (super.noSuchMethod( - Invocation.method( - #setAllHttpHeaderFields, - [fields], - ), + Invocation.method(#setAllHttpHeaderFields, [fields]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -402,25 +312,16 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @override _i4.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method( - #getAllHttpHeaderFields, - [], - ), + Invocation.method(#getAllHttpHeaderFields, []), returnValue: _i4.Future?>.value(), ) as _i4.Future?>); @override _i2.URLRequest pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeURLRequest_2( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.URLRequest); @@ -431,31 +332,15 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -470,6 +355,72 @@ class MockWKNavigationDelegate extends _i1.Mock _i1.throwOnMissingStub(this); } + @override + _i4.Future<_i2.NavigationActionPolicy> Function( + _i2.WKNavigationDelegate, + _i2.WKWebView, + _i2.WKNavigationAction, + ) get decidePolicyForNavigationAction => (super.noSuchMethod( + Invocation.getter(#decidePolicyForNavigationAction), + returnValue: ( + _i2.WKNavigationDelegate pigeon_instance, + _i2.WKWebView webView, + _i2.WKNavigationAction navigationAction, + ) => + _i4.Future<_i2.NavigationActionPolicy>.value( + _i2.NavigationActionPolicy.allow, + ), + ) as _i4.Future<_i2.NavigationActionPolicy> Function( + _i2.WKNavigationDelegate, + _i2.WKWebView, + _i2.WKNavigationAction, + )); + + @override + _i4.Future<_i2.NavigationResponsePolicy> Function( + _i2.WKNavigationDelegate, + _i2.WKWebView, + _i2.WKNavigationResponse, + ) get decidePolicyForNavigationResponse => (super.noSuchMethod( + Invocation.getter(#decidePolicyForNavigationResponse), + returnValue: ( + _i2.WKNavigationDelegate pigeon_instance, + _i2.WKWebView webView, + _i2.WKNavigationResponse navigationResponse, + ) => + _i4.Future<_i2.NavigationResponsePolicy>.value( + _i2.NavigationResponsePolicy.allow, + ), + ) as _i4.Future<_i2.NavigationResponsePolicy> Function( + _i2.WKNavigationDelegate, + _i2.WKWebView, + _i2.WKNavigationResponse, + )); + + @override + _i4.Future<_i2.AuthenticationChallengeResponse> Function( + _i2.WKNavigationDelegate, + _i2.WKWebView, + _i2.URLAuthenticationChallenge, + ) get didReceiveAuthenticationChallenge => (super.noSuchMethod( + Invocation.getter(#didReceiveAuthenticationChallenge), + returnValue: ( + _i2.WKNavigationDelegate pigeon_instance, + _i2.WKWebView webView, + _i2.URLAuthenticationChallenge challenge, + ) => + _i4.Future<_i2.AuthenticationChallengeResponse>.value( + _FakeAuthenticationChallengeResponse_3( + this, + Invocation.getter(#didReceiveAuthenticationChallenge), + ), + ), + ) as _i4.Future<_i2.AuthenticationChallengeResponse> Function( + _i2.WKNavigationDelegate, + _i2.WKWebView, + _i2.URLAuthenticationChallenge, + )); + @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), @@ -481,16 +432,10 @@ class MockWKNavigationDelegate extends _i1.Mock @override _i2.WKNavigationDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeWKNavigationDelegate_3( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKNavigationDelegate_4( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKNavigationDelegate); @@ -501,31 +446,15 @@ class MockWKNavigationDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -550,26 +479,17 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { @override _i4.Future setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method( - #setJavaScriptEnabled, - [enabled], - ), + Invocation.method(#setJavaScriptEnabled, [enabled]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i2.WKPreferences pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeWKPreferences_4( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKPreferences_5( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKPreferences); @@ -580,31 +500,15 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -648,16 +552,10 @@ class MockWKScriptMessageHandler extends _i1.Mock @override _i2.WKScriptMessageHandler pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeWKScriptMessageHandler_5( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKScriptMessageHandler_6( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKScriptMessageHandler); @@ -668,31 +566,15 @@ class MockWKScriptMessageHandler extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -717,16 +599,10 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { @override _i2.WKWebView pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeWKWebView_6( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebView_7( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebView); @@ -737,31 +613,15 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -778,7 +638,7 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i2.WKWebViewConfiguration get configuration => (super.noSuchMethod( Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_7( + returnValue: _FakeWKWebViewConfiguration_8( this, Invocation.getter(#configuration), ), @@ -804,41 +664,26 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i2.WKWebViewConfiguration pigeonVar_configuration() => (super.noSuchMethod( - Invocation.method( - #pigeonVar_configuration, - [], - ), - returnValue: _FakeWKWebViewConfiguration_7( + Invocation.method(#pigeonVar_configuration, []), + returnValue: _FakeWKWebViewConfiguration_8( this, - Invocation.method( - #pigeonVar_configuration, - [], - ), + Invocation.method(#pigeonVar_configuration, []), ), ) as _i2.WKWebViewConfiguration); @override _i2.UIScrollView pigeonVar_scrollView() => (super.noSuchMethod( - Invocation.method( - #pigeonVar_scrollView, - [], - ), + Invocation.method(#pigeonVar_scrollView, []), returnValue: _FakeUIScrollView_1( this, - Invocation.method( - #pigeonVar_scrollView, - [], - ), + Invocation.method(#pigeonVar_scrollView, []), ), ) as _i2.UIScrollView); @override _i4.Future setUIDelegate(_i2.WKUIDelegate? delegate) => (super.noSuchMethod( - Invocation.method( - #setUIDelegate, - [delegate], - ), + Invocation.method(#setUIDelegate, [delegate]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -846,160 +691,103 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i4.Future setNavigationDelegate(_i2.WKNavigationDelegate? delegate) => (super.noSuchMethod( - Invocation.method( - #setNavigationDelegate, - [delegate], - ), + Invocation.method(#setNavigationDelegate, [delegate]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future getUrl() => (super.noSuchMethod( - Invocation.method( - #getUrl, - [], - ), + Invocation.method(#getUrl, []), returnValue: _i4.Future.value(), ) as _i4.Future); @override _i4.Future getEstimatedProgress() => (super.noSuchMethod( - Invocation.method( - #getEstimatedProgress, - [], - ), + Invocation.method(#getEstimatedProgress, []), returnValue: _i4.Future.value(0.0), ) as _i4.Future); @override _i4.Future load(_i2.URLRequest? request) => (super.noSuchMethod( - Invocation.method( - #load, - [request], - ), + Invocation.method(#load, [request]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future loadHtmlString( - String? string, - String? baseUrl, - ) => + _i4.Future loadHtmlString(String? string, String? baseUrl) => (super.noSuchMethod( - Invocation.method( - #loadHtmlString, - [ - string, - baseUrl, - ], - ), + Invocation.method(#loadHtmlString, [string, baseUrl]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future loadFileUrl( - String? url, - String? readAccessUrl, - ) => + _i4.Future loadFileUrl(String? url, String? readAccessUrl) => (super.noSuchMethod( - Invocation.method( - #loadFileUrl, - [ - url, - readAccessUrl, - ], - ), + Invocation.method(#loadFileUrl, [url, readAccessUrl]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future loadFlutterAsset(String? key) => (super.noSuchMethod( - Invocation.method( - #loadFlutterAsset, - [key], - ), + Invocation.method(#loadFlutterAsset, [key]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future canGoBack() => (super.noSuchMethod( - Invocation.method( - #canGoBack, - [], - ), + Invocation.method(#canGoBack, []), returnValue: _i4.Future.value(false), ) as _i4.Future); @override _i4.Future canGoForward() => (super.noSuchMethod( - Invocation.method( - #canGoForward, - [], - ), + Invocation.method(#canGoForward, []), returnValue: _i4.Future.value(false), ) as _i4.Future); @override _i4.Future goBack() => (super.noSuchMethod( - Invocation.method( - #goBack, - [], - ), + Invocation.method(#goBack, []), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future goForward() => (super.noSuchMethod( - Invocation.method( - #goForward, - [], - ), + Invocation.method(#goForward, []), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future reload() => (super.noSuchMethod( - Invocation.method( - #reload, - [], - ), + Invocation.method(#reload, []), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future getTitle() => (super.noSuchMethod( - Invocation.method( - #getTitle, - [], - ), + Invocation.method(#getTitle, []), returnValue: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( - Invocation.method( - #setAllowsBackForwardNavigationGestures, - [allow], - ), + Invocation.method(#setAllowsBackForwardNavigationGestures, [allow]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod( - Invocation.method( - #setCustomUserAgent, - [userAgent], - ), + Invocation.method(#setCustomUserAgent, [userAgent]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1007,63 +795,42 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i4.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( - Invocation.method( - #evaluateJavaScript, - [javaScriptString], - ), + Invocation.method(#evaluateJavaScript, [javaScriptString]), returnValue: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setInspectable(bool? inspectable) => (super.noSuchMethod( - Invocation.method( - #setInspectable, - [inspectable], - ), + Invocation.method(#setInspectable, [inspectable]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future getCustomUserAgent() => (super.noSuchMethod( - Invocation.method( - #getCustomUserAgent, - [], - ), + Invocation.method(#getCustomUserAgent, []), returnValue: _i4.Future.value(), ) as _i4.Future); @override _i2.UIViewWKWebView pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeUIViewWKWebView_8( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIViewWKWebView_9( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.UIViewWKWebView); @override _i4.Future setBackgroundColor(int? value) => (super.noSuchMethod( - Invocation.method( - #setBackgroundColor, - [value], - ), + Invocation.method(#setBackgroundColor, [value]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setOpaque(bool? opaque) => (super.noSuchMethod( - Invocation.method( - #setOpaque, - [opaque], - ), + Invocation.method(#setOpaque, [opaque]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1075,31 +842,15 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1125,12 +876,10 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i4.Future setUserContentController( - _i2.WKUserContentController? controller) => + _i2.WKUserContentController? controller, + ) => (super.noSuchMethod( - Invocation.method( - #setUserContentController, - [controller], - ), + Invocation.method(#setUserContentController, [controller]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1138,27 +887,19 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i4.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( - Invocation.method( - #getUserContentController, - [], - ), + Invocation.method(#getUserContentController, []), returnValue: _i4.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_9( - this, - Invocation.method( - #getUserContentController, - [], + _FakeWKUserContentController_10( + this, + Invocation.method(#getUserContentController, []), ), - )), + ), ) as _i4.Future<_i2.WKUserContentController>); @override _i4.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method( - #setWebsiteDataStore, - [dataStore], - ), + Invocation.method(#setWebsiteDataStore, [dataStore]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1166,53 +907,38 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i4.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( - Invocation.method( - #getWebsiteDataStore, - [], - ), - returnValue: - _i4.Future<_i2.WKWebsiteDataStore>.value(_FakeWKWebsiteDataStore_10( - this, - Invocation.method( - #getWebsiteDataStore, - [], + Invocation.method(#getWebsiteDataStore, []), + returnValue: _i4.Future<_i2.WKWebsiteDataStore>.value( + _FakeWKWebsiteDataStore_11( + this, + Invocation.method(#getWebsiteDataStore, []), ), - )), + ), ) as _i4.Future<_i2.WKWebsiteDataStore>); @override _i4.Future setPreferences(_i2.WKPreferences? preferences) => (super.noSuchMethod( - Invocation.method( - #setPreferences, - [preferences], - ), + Invocation.method(#setPreferences, [preferences]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future<_i2.WKPreferences> getPreferences() => (super.noSuchMethod( - Invocation.method( - #getPreferences, - [], - ), - returnValue: _i4.Future<_i2.WKPreferences>.value(_FakeWKPreferences_4( - this, - Invocation.method( - #getPreferences, - [], + Invocation.method(#getPreferences, []), + returnValue: _i4.Future<_i2.WKPreferences>.value( + _FakeWKPreferences_5( + this, + Invocation.method(#getPreferences, []), ), - )), + ), ) as _i4.Future<_i2.WKPreferences>); @override _i4.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( - Invocation.method( - #setAllowsInlineMediaPlayback, - [allow], - ), + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1220,38 +946,41 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i4.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method( - #setLimitsNavigationsToAppBoundDomains, - [limit], - ), + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setMediaTypesRequiringUserActionForPlayback( - _i2.AudiovisualMediaType? type) => + _i2.AudiovisualMediaType? type, + ) => (super.noSuchMethod( - Invocation.method( - #setMediaTypesRequiringUserActionForPlayback, - [type], - ), + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], + _i4.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => + (super.noSuchMethod( + Invocation.method(#getDefaultWebpagePreferences, []), + returnValue: _i4.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_12( + this, + Invocation.method(#getDefaultWebpagePreferences, []), + ), ), - returnValue: _FakeWKWebViewConfiguration_7( + ) as _i4.Future<_i2.WKWebpagePreferences>); + + @override + _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebViewConfiguration_8( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebViewConfiguration); @@ -1262,31 +991,15 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1304,7 +1017,7 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_11( + returnValue: _FakeWKHTTPCookieStore_13( this, Invocation.getter(#httpCookieStore), ), @@ -1321,16 +1034,10 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), - returnValue: _FakeWKHTTPCookieStore_11( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_13( this, - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), + Invocation.method(#pigeonVar_httpCookieStore, []), ), ) as _i2.WKHTTPCookieStore); @@ -1340,28 +1047,19 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method( - #removeDataOfTypes, - [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ], - ), + Invocation.method(#removeDataOfTypes, [ + dataTypes, + modificationTimeInSecondsSinceEpoch, + ]), returnValue: _i4.Future.value(false), ) as _i4.Future); @override _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeWKWebsiteDataStore_10( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_11( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebsiteDataStore); @@ -1372,31 +1070,15 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1410,6 +1092,55 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { _i1.throwOnMissingStub(this); } + @override + _i4.Future<_i2.PermissionDecision> Function( + _i2.WKUIDelegate, + _i2.WKWebView, + _i2.WKSecurityOrigin, + _i2.WKFrameInfo, + _i2.MediaCaptureType, + ) get requestMediaCapturePermission => (super.noSuchMethod( + Invocation.getter(#requestMediaCapturePermission), + returnValue: ( + _i2.WKUIDelegate pigeon_instance, + _i2.WKWebView webView, + _i2.WKSecurityOrigin origin, + _i2.WKFrameInfo frame, + _i2.MediaCaptureType type, + ) => + _i4.Future<_i2.PermissionDecision>.value( + _i2.PermissionDecision.deny, + ), + ) as _i4.Future<_i2.PermissionDecision> Function( + _i2.WKUIDelegate, + _i2.WKWebView, + _i2.WKSecurityOrigin, + _i2.WKFrameInfo, + _i2.MediaCaptureType, + )); + + @override + _i4.Future Function( + _i2.WKUIDelegate, + _i2.WKWebView, + String, + _i2.WKFrameInfo, + ) get runJavaScriptConfirmPanel => (super.noSuchMethod( + Invocation.getter(#runJavaScriptConfirmPanel), + returnValue: ( + _i2.WKUIDelegate pigeon_instance, + _i2.WKWebView webView, + String message, + _i2.WKFrameInfo frame, + ) => + _i4.Future.value(false), + ) as _i4.Future Function( + _i2.WKUIDelegate, + _i2.WKWebView, + String, + _i2.WKFrameInfo, + )); + @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), @@ -1421,16 +1152,10 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { @override _i2.WKUIDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeWKUIDelegate_12( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUIDelegate_14( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKUIDelegate); @@ -1441,31 +1166,15 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1495,13 +1204,7 @@ class MockWKUserContentController extends _i1.Mock String? name, ) => (super.noSuchMethod( - Invocation.method( - #addScriptMessageHandler, - [ - handler, - name, - ], - ), + Invocation.method(#addScriptMessageHandler, [handler, name]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1509,20 +1212,14 @@ class MockWKUserContentController extends _i1.Mock @override _i4.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( - Invocation.method( - #removeScriptMessageHandler, - [name], - ), + Invocation.method(#removeScriptMessageHandler, [name]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( - Invocation.method( - #removeAllScriptMessageHandlers, - [], - ), + Invocation.method(#removeAllScriptMessageHandlers, []), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1530,36 +1227,24 @@ class MockWKUserContentController extends _i1.Mock @override _i4.Future addUserScript(_i2.WKUserScript? userScript) => (super.noSuchMethod( - Invocation.method( - #addUserScript, - [userScript], - ), + Invocation.method(#addUserScript, [userScript]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future removeAllUserScripts() => (super.noSuchMethod( - Invocation.method( - #removeAllUserScripts, - [], - ), + Invocation.method(#removeAllUserScripts, []), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i2.WKUserContentController pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeWKUserContentController_9( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUserContentController_10( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKUserContentController); @@ -1570,31 +1255,15 @@ class MockWKUserContentController extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -1616,28 +1285,16 @@ class MockJavascriptChannelRegistry extends _i1.Mock ) as Map); @override - void onJavascriptChannelMessage( - String? channel, - String? message, - ) => + void onJavascriptChannelMessage(String? channel, String? message) => super.noSuchMethod( - Invocation.method( - #onJavascriptChannelMessage, - [ - channel, - message, - ], - ), + Invocation.method(#onJavascriptChannelMessage, [channel, message]), returnValueForMissingStub: null, ); @override void updateJavascriptChannelsFromSet(Set<_i7.JavascriptChannel>? channels) => super.noSuchMethod( - Invocation.method( - #updateJavascriptChannelsFromSet, - [channels], - ), + Invocation.method(#updateJavascriptChannelsFromSet, [channels]), returnValueForMissingStub: null, ); } @@ -1657,50 +1314,34 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock required bool? isForMainFrame, }) => (super.noSuchMethod( - Invocation.method( - #onNavigationRequest, - [], - { - #url: url, - #isForMainFrame: isForMainFrame, - }, - ), + Invocation.method(#onNavigationRequest, [], { + #url: url, + #isForMainFrame: isForMainFrame, + }), returnValue: _i4.Future.value(false), ) as _i4.FutureOr); @override void onPageStarted(String? url) => super.noSuchMethod( - Invocation.method( - #onPageStarted, - [url], - ), + Invocation.method(#onPageStarted, [url]), returnValueForMissingStub: null, ); @override void onPageFinished(String? url) => super.noSuchMethod( - Invocation.method( - #onPageFinished, - [url], - ), + Invocation.method(#onPageFinished, [url]), returnValueForMissingStub: null, ); @override void onProgress(int? progress) => super.noSuchMethod( - Invocation.method( - #onProgress, - [progress], - ), + Invocation.method(#onProgress, [progress]), returnValueForMissingStub: null, ); @override void onWebResourceError(_i8.WebResourceError? error) => super.noSuchMethod( - Invocation.method( - #onWebResourceError, - [error], - ), + Invocation.method(#onWebResourceError, [error]), returnValueForMissingStub: null, ); } @@ -1717,11 +1358,8 @@ class MockWebViewWidgetProxy extends _i1.Mock @override _i3.PlatformWebView createWebView( _i2.WKWebViewConfiguration? configuration, { - void Function( - String, - _i2.NSObject, - Map<_i2.KeyValueChangeKey, Object?>, - )? observeValue, + void Function(String, _i2.NSObject, Map<_i2.KeyValueChangeKey, Object?>)? + observeValue, }) => (super.noSuchMethod( Invocation.method( @@ -1729,7 +1367,7 @@ class MockWebViewWidgetProxy extends _i1.Mock [configuration], {#observeValue: observeValue}, ), - returnValue: _FakePlatformWebView_13( + returnValue: _FakePlatformWebView_15( this, Invocation.method( #createWebView, @@ -1741,99 +1379,71 @@ class MockWebViewWidgetProxy extends _i1.Mock @override _i2.URLRequest createRequest({required String? url}) => (super.noSuchMethod( - Invocation.method( - #createRequest, - [], - {#url: url}, - ), + Invocation.method(#createRequest, [], {#url: url}), returnValue: _FakeURLRequest_2( this, - Invocation.method( - #createRequest, - [], - {#url: url}, - ), + Invocation.method(#createRequest, [], {#url: url}), ), ) as _i2.URLRequest); @override - _i2.WKScriptMessageHandler createScriptMessageHandler( - {required void Function( - _i2.WKScriptMessageHandler, - _i2.WKUserContentController, - _i2.WKScriptMessage, - )? didReceiveScriptMessage}) => + _i2.WKScriptMessageHandler createScriptMessageHandler({ + required void Function( + _i2.WKScriptMessageHandler, + _i2.WKUserContentController, + _i2.WKScriptMessage, + )? didReceiveScriptMessage, + }) => (super.noSuchMethod( - Invocation.method( - #createScriptMessageHandler, - [], - {#didReceiveScriptMessage: didReceiveScriptMessage}, - ), - returnValue: _FakeWKScriptMessageHandler_5( + Invocation.method(#createScriptMessageHandler, [], { + #didReceiveScriptMessage: didReceiveScriptMessage, + }), + returnValue: _FakeWKScriptMessageHandler_6( this, - Invocation.method( - #createScriptMessageHandler, - [], - {#didReceiveScriptMessage: didReceiveScriptMessage}, - ), + Invocation.method(#createScriptMessageHandler, [], { + #didReceiveScriptMessage: didReceiveScriptMessage, + }), ), ) as _i2.WKScriptMessageHandler); @override - _i2.WKUIDelegate createUIDelgate( - {void Function( - _i2.WKUIDelegate, - _i2.WKWebView, - _i2.WKWebViewConfiguration, - _i2.WKNavigationAction, - )? onCreateWebView}) => + _i2.WKUIDelegate createUIDelgate({ + void Function( + _i2.WKUIDelegate, + _i2.WKWebView, + _i2.WKWebViewConfiguration, + _i2.WKNavigationAction, + )? onCreateWebView, + }) => (super.noSuchMethod( - Invocation.method( - #createUIDelgate, - [], - {#onCreateWebView: onCreateWebView}, - ), - returnValue: _FakeWKUIDelegate_12( + Invocation.method(#createUIDelgate, [], { + #onCreateWebView: onCreateWebView, + }), + returnValue: _FakeWKUIDelegate_14( this, - Invocation.method( - #createUIDelgate, - [], - {#onCreateWebView: onCreateWebView}, - ), + Invocation.method(#createUIDelgate, [], { + #onCreateWebView: onCreateWebView, + }), ), ) as _i2.WKUIDelegate); @override _i2.WKNavigationDelegate createNavigationDelegate({ - void Function( - _i2.WKNavigationDelegate, - _i2.WKWebView, - String?, - )? didFinishNavigation, - void Function( - _i2.WKNavigationDelegate, - _i2.WKWebView, - String?, - )? didStartProvisionalNavigation, + void Function(_i2.WKNavigationDelegate, _i2.WKWebView, String?)? + didFinishNavigation, + void Function(_i2.WKNavigationDelegate, _i2.WKWebView, String?)? + didStartProvisionalNavigation, required _i4.Future<_i2.NavigationActionPolicy> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.WKNavigationAction, )? decidePolicyForNavigationAction, - void Function( - _i2.WKNavigationDelegate, - _i2.WKWebView, - _i2.NSError, - )? didFailNavigation, - void Function( - _i2.WKNavigationDelegate, - _i2.WKWebView, - _i2.NSError, - )? didFailProvisionalNavigation, - void Function( - _i2.WKNavigationDelegate, - _i2.WKWebView, - )? webViewWebContentProcessDidTerminate, + void Function(_i2.WKNavigationDelegate, _i2.WKWebView, _i2.NSError)? + didFailNavigation, + void Function(_i2.WKNavigationDelegate, _i2.WKWebView, _i2.NSError)? + didFailProvisionalNavigation, + void Function(_i2.WKNavigationDelegate, _i2.WKWebView)? + webViewWebContentProcessDidTerminate, required _i4.Future<_i2.NavigationResponsePolicy> Function( _i2.WKNavigationDelegate, _i2.WKWebView, @@ -1846,10 +1456,20 @@ class MockWebViewWidgetProxy extends _i1.Mock )? didReceiveAuthenticationChallenge, }) => (super.noSuchMethod( - Invocation.method( - #createNavigationDelegate, - [], - { + Invocation.method(#createNavigationDelegate, [], { + #didFinishNavigation: didFinishNavigation, + #didStartProvisionalNavigation: didStartProvisionalNavigation, + #decidePolicyForNavigationAction: decidePolicyForNavigationAction, + #didFailNavigation: didFailNavigation, + #didFailProvisionalNavigation: didFailProvisionalNavigation, + #webViewWebContentProcessDidTerminate: + webViewWebContentProcessDidTerminate, + #decidePolicyForNavigationResponse: decidePolicyForNavigationResponse, + #didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, + }), + returnValue: _FakeWKNavigationDelegate_4( + this, + Invocation.method(#createNavigationDelegate, [], { #didFinishNavigation: didFinishNavigation, #didStartProvisionalNavigation: didStartProvisionalNavigation, #decidePolicyForNavigationAction: decidePolicyForNavigationAction, @@ -1861,27 +1481,63 @@ class MockWebViewWidgetProxy extends _i1.Mock decidePolicyForNavigationResponse, #didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, - }, + }), ), - returnValue: _FakeWKNavigationDelegate_3( + ) as _i2.WKNavigationDelegate); +} + +/// A class which mocks [WKWebpagePreferences]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockWKWebpagePreferences extends _i1.Mock + implements _i2.WKWebpagePreferences { + MockWKWebpagePreferences() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( this, - Invocation.method( - #createNavigationDelegate, - [], - { - #didFinishNavigation: didFinishNavigation, - #didStartProvisionalNavigation: didStartProvisionalNavigation, - #decidePolicyForNavigationAction: decidePolicyForNavigationAction, - #didFailNavigation: didFailNavigation, - #didFailProvisionalNavigation: didFailProvisionalNavigation, - #webViewWebContentProcessDidTerminate: - webViewWebContentProcessDidTerminate, - #decidePolicyForNavigationResponse: - decidePolicyForNavigationResponse, - #didReceiveAuthenticationChallenge: - didReceiveAuthenticationChallenge, - }, - ), + Invocation.getter(#pigeon_instanceManager), ), - ) as _i2.WKNavigationDelegate); + ) as _i2.PigeonInstanceManager); + + @override + _i4.Future setAllowsContentJavaScript(bool? allow) => + (super.noSuchMethod( + Invocation.method(#setAllowsContentJavaScript, [allow]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i2.WKWebpagePreferences pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebpagePreferences_12( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebpagePreferences); + + @override + _i4.Future addObserver( + _i2.NSObject? observer, + String? keyPath, + List<_i2.KeyValueObservingOptions>? options, + ) => + (super.noSuchMethod( + Invocation.method(#addObserver, [observer, keyPath, options]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); + + @override + _i4.Future removeObserver(_i2.NSObject? observer, String? keyPath) => + (super.noSuchMethod( + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart index 05cf5dd7883..f19e2d23f2f 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart @@ -47,6 +47,19 @@ void main() { CapturingNavigationDelegate.lastCreatedDelegate.didFinishNavigation!( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -73,6 +86,19 @@ void main() { .lastCreatedDelegate.didStartProvisionalNavigation!( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -99,10 +125,23 @@ void main() { await webKitDelegate.setOnHttpError(onHttpError); - await CapturingNavigationDelegate - .lastCreatedDelegate.decidePolicyForNavigationResponse!( + await CapturingNavigationDelegate.lastCreatedDelegate + .decidePolicyForNavigationResponse( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -136,10 +175,23 @@ void main() { await webKitDelegate.setOnHttpError(onHttpError); - await CapturingNavigationDelegate - .lastCreatedDelegate.decidePolicyForNavigationResponse!( + await CapturingNavigationDelegate.lastCreatedDelegate + .decidePolicyForNavigationResponse( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -176,6 +228,19 @@ void main() { CapturingNavigationDelegate.lastCreatedDelegate.didFailNavigation!( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -219,6 +284,19 @@ void main() { .lastCreatedDelegate.didFailProvisionalNavigation!( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -263,6 +341,19 @@ void main() { .lastCreatedDelegate.webViewWebContentProcessDidTerminate!( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -304,10 +395,23 @@ void main() { ); expect( - await CapturingNavigationDelegate - .lastCreatedDelegate.decidePolicyForNavigationAction!( + await CapturingNavigationDelegate.lastCreatedDelegate + .decidePolicyForNavigationAction( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -381,10 +485,23 @@ void main() { }, ); - await CapturingNavigationDelegate - .lastCreatedDelegate.didReceiveAuthenticationChallenge!( + await CapturingNavigationDelegate.lastCreatedDelegate + .didReceiveAuthenticationChallenge( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -446,10 +563,23 @@ void main() { }, ); - await CapturingNavigationDelegate - .lastCreatedDelegate.didReceiveAuthenticationChallenge!( + await CapturingNavigationDelegate.lastCreatedDelegate + .didReceiveAuthenticationChallenge( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, ), WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), @@ -468,17 +598,30 @@ class CapturingNavigationDelegate extends WKNavigationDelegate { CapturingNavigationDelegate({ super.didFinishNavigation, super.didStartProvisionalNavigation, - super.decidePolicyForNavigationResponse, + required super.decidePolicyForNavigationResponse, super.didFailNavigation, super.didFailProvisionalNavigation, - super.decidePolicyForNavigationAction, + required super.decidePolicyForNavigationAction, super.webViewWebContentProcessDidTerminate, - super.didReceiveAuthenticationChallenge, + required super.didReceiveAuthenticationChallenge, }) : super.pigeon_detached(pigeon_instanceManager: TestInstanceManager()) { lastCreatedDelegate = this; } static CapturingNavigationDelegate lastCreatedDelegate = - CapturingNavigationDelegate(); + CapturingNavigationDelegate( + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, + ); } // Test InstanceManager that sets `onWeakReferenceRemoved` as a noop. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.mocks.dart index d30c175724e..503c38a6dc5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart. // Do not manually edit this file. @@ -18,6 +18,7 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -25,55 +26,30 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; class _FakePigeonInstanceManager_0 extends _i1.SmartFake implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePigeonInstanceManager_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeURLProtectionSpace_1 extends _i1.SmartFake implements _i2.URLProtectionSpace { - _FakeURLProtectionSpace_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeURLProtectionSpace_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeURLAuthenticationChallenge_2 extends _i1.SmartFake implements _i2.URLAuthenticationChallenge { - _FakeURLAuthenticationChallenge_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeURLAuthenticationChallenge_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeURLRequest_3 extends _i1.SmartFake implements _i2.URLRequest { - _FakeURLRequest_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeURLRequest_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeURL_4 extends _i1.SmartFake implements _i2.URL { - _FakeURL_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeURL_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [URLAuthenticationChallenge]. @@ -97,32 +73,21 @@ class MockURLAuthenticationChallenge extends _i1.Mock @override _i3.Future<_i2.URLProtectionSpace> getProtectionSpace() => (super.noSuchMethod( - Invocation.method( - #getProtectionSpace, - [], - ), - returnValue: - _i3.Future<_i2.URLProtectionSpace>.value(_FakeURLProtectionSpace_1( - this, - Invocation.method( - #getProtectionSpace, - [], + Invocation.method(#getProtectionSpace, []), + returnValue: _i3.Future<_i2.URLProtectionSpace>.value( + _FakeURLProtectionSpace_1( + this, + Invocation.method(#getProtectionSpace, []), ), - )), + ), ) as _i3.Future<_i2.URLProtectionSpace>); @override _i2.URLAuthenticationChallenge pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeURLAuthenticationChallenge_2( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.URLAuthenticationChallenge); @@ -133,31 +98,15 @@ class MockURLAuthenticationChallenge extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -182,58 +131,40 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @override _i3.Future getUrl() => (super.noSuchMethod( - Invocation.method( - #getUrl, - [], - ), + Invocation.method(#getUrl, []), returnValue: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setHttpMethod(String? method) => (super.noSuchMethod( - Invocation.method( - #setHttpMethod, - [method], - ), + Invocation.method(#setHttpMethod, [method]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future getHttpMethod() => (super.noSuchMethod( - Invocation.method( - #getHttpMethod, - [], - ), + Invocation.method(#getHttpMethod, []), returnValue: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setHttpBody(_i4.Uint8List? body) => (super.noSuchMethod( - Invocation.method( - #setHttpBody, - [body], - ), + Invocation.method(#setHttpBody, [body]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future<_i4.Uint8List?> getHttpBody() => (super.noSuchMethod( - Invocation.method( - #getHttpBody, - [], - ), + Invocation.method(#getHttpBody, []), returnValue: _i3.Future<_i4.Uint8List?>.value(), ) as _i3.Future<_i4.Uint8List?>); @override _i3.Future setAllHttpHeaderFields(Map? fields) => (super.noSuchMethod( - Invocation.method( - #setAllHttpHeaderFields, - [fields], - ), + Invocation.method(#setAllHttpHeaderFields, [fields]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -241,25 +172,16 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @override _i3.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method( - #getAllHttpHeaderFields, - [], - ), + Invocation.method(#getAllHttpHeaderFields, []), returnValue: _i3.Future?>.value(), ) as _i3.Future?>); @override _i2.URLRequest pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeURLRequest_3( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.URLRequest); @@ -270,31 +192,15 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -319,32 +225,19 @@ class MockURL extends _i1.Mock implements _i2.URL { @override _i3.Future getAbsoluteString() => (super.noSuchMethod( - Invocation.method( - #getAbsoluteString, - [], - ), - returnValue: _i3.Future.value(_i5.dummyValue( - this, - Invocation.method( - #getAbsoluteString, - [], + Invocation.method(#getAbsoluteString, []), + returnValue: _i3.Future.value( + _i5.dummyValue( + this, + Invocation.method(#getAbsoluteString, []), ), - )), + ), ) as _i3.Future); @override _i2.URL pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeURL_4( - this, - Invocation.method( - #pigeon_copy, - [], - ), - ), + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURL_4(this, Invocation.method(#pigeon_copy, [])), ) as _i2.URL); @override @@ -354,31 +247,15 @@ class MockURL extends _i1.Mock implements _i2.URL { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart index c488d7e8b56..798fe7bd444 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart @@ -30,6 +30,7 @@ import 'webkit_webview_controller_test.mocks.dart'; MockSpec(), MockSpec(), MockSpec(), + MockSpec(), MockSpec(), MockSpec(), ]) @@ -56,6 +57,7 @@ void main() { MockWKWebViewConfiguration? mockWebViewConfiguration, MockURLRequest Function({required String url})? createURLRequest, PigeonInstanceManager? instanceManager, + MockWKWebpagePreferences? mockWebpagePreferences, }) { final MockWKWebViewConfiguration nonNullMockWebViewConfiguration = mockWebViewConfiguration ?? MockWKWebViewConfiguration(); @@ -92,25 +94,25 @@ void main() { WKWebViewConfiguration, WKNavigationAction, )? onCreateWebView, - Future Function( + required Future Function( WKUIDelegate, WKWebView, WKSecurityOrigin, WKFrameInfo, MediaCaptureType, - )? requestMediaCapturePermission, + ) requestMediaCapturePermission, Future Function( WKUIDelegate, WKWebView, String, WKFrameInfo, )? runJavaScriptAlertPanel, - Future Function( + required Future Function( WKUIDelegate, WKWebView, String, WKFrameInfo, - )? runJavaScriptConfirmPanel, + ) runJavaScriptConfirmPanel, Future Function( WKUIDelegate, WKWebView, @@ -185,6 +187,10 @@ void main() { mockPreferences ?? MockWKPreferences(), ), ); + when(nonNullMockWebViewConfiguration.getDefaultWebpagePreferences()) + .thenAnswer( + (_) async => mockWebpagePreferences ?? MockWKWebpagePreferences(), + ); when(nonNullMockWebViewConfiguration.getUserContentController()) .thenAnswer( (_) => Future.value( @@ -735,27 +741,49 @@ void main() { }); test('enable JavaScript', () async { - final MockWKPreferences mockPreferences = MockWKPreferences(); + final MockWKWebpagePreferences mockWebpagePreferences = + MockWKWebpagePreferences(); final WebKitWebViewController controller = createControllerWithMocks( - mockPreferences: mockPreferences, + mockWebpagePreferences: mockWebpagePreferences, ); await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - verify(mockPreferences.setJavaScriptEnabled(true)); + verify(mockWebpagePreferences.setAllowsContentJavaScript(true)); }); test('disable JavaScript', () async { + final MockWKWebpagePreferences mockWebpagePreferences = + MockWKWebpagePreferences(); + + final WebKitWebViewController controller = createControllerWithMocks( + mockWebpagePreferences: mockWebpagePreferences, + ); + + await controller.setJavaScriptMode(JavaScriptMode.disabled); + + verify(mockWebpagePreferences.setAllowsContentJavaScript(false)); + }); + + test( + 'enable JavaScript calls WKPreferences.setJavaScriptEnabled for lower versions', + () async { final MockWKPreferences mockPreferences = MockWKPreferences(); + final MockWKWebpagePreferences mockWebpagePreferences = + MockWKWebpagePreferences(); + when(mockWebpagePreferences.setAllowsContentJavaScript(any)).thenThrow( + PlatformException(code: 'PigeonUnsupportedOperationError'), + ); final WebKitWebViewController controller = createControllerWithMocks( mockPreferences: mockPreferences, + mockWebpagePreferences: mockWebpagePreferences, ); - await controller.setJavaScriptMode(JavaScriptMode.disabled); + await controller.setJavaScriptMode(JavaScriptMode.unrestricted); - verify(mockPreferences.setJavaScriptEnabled(false)); + verify(mockPreferences.setJavaScriptEnabled(true)); }); test('clearCache', () { @@ -1146,7 +1174,14 @@ void main() { test('Requests to open a new window loads request in same window', () { // Reset last created delegate. - CapturingUIDelegate.lastCreatedDelegate = CapturingUIDelegate(); + CapturingUIDelegate.lastCreatedDelegate = CapturingUIDelegate( + requestMediaCapturePermission: (_, __, ___, ____, _____) async { + return PermissionDecision.deny; + }, + runJavaScriptConfirmPanel: (_, __, ___, ____) async { + return false; + }, + ); // Create a new WebKitWebViewController that sets // CapturingUIDelegate.lastCreatedDelegate. @@ -1383,8 +1418,8 @@ void main() { WKSecurityOrigin origin, WKFrameInfo frame, MediaCaptureType type, - ) onPermissionRequestCallback = CapturingUIDelegate - .lastCreatedDelegate.requestMediaCapturePermission!; + ) onPermissionRequestCallback = + CapturingUIDelegate.lastCreatedDelegate.requestMediaCapturePermission; final PermissionDecision decision = await onPermissionRequestCallback( CapturingUIDelegate.lastCreatedDelegate, @@ -1464,7 +1499,7 @@ void main() { String message, WKFrameInfo frame, ) onJavaScriptConfirmPanel = - CapturingUIDelegate.lastCreatedDelegate.runJavaScriptConfirmPanel!; + CapturingUIDelegate.lastCreatedDelegate.runJavaScriptConfirmPanel; final MockURLRequest mockRequest = MockURLRequest(); when(mockRequest.getUrl()).thenAnswer( @@ -1835,31 +1870,51 @@ class CapturingNavigationDelegate extends WKNavigationDelegate { CapturingNavigationDelegate({ super.didFinishNavigation, super.didStartProvisionalNavigation, - super.decidePolicyForNavigationResponse, + required super.decidePolicyForNavigationResponse, super.didFailNavigation, super.didFailProvisionalNavigation, - super.decidePolicyForNavigationAction, + required super.decidePolicyForNavigationAction, super.webViewWebContentProcessDidTerminate, - super.didReceiveAuthenticationChallenge, + required super.didReceiveAuthenticationChallenge, }) : super.pigeon_detached(pigeon_instanceManager: TestInstanceManager()) { lastCreatedDelegate = this; } static CapturingNavigationDelegate lastCreatedDelegate = - CapturingNavigationDelegate(); + CapturingNavigationDelegate( + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); + }, + ); } // Records the last created instance of itself. class CapturingUIDelegate extends WKUIDelegate { CapturingUIDelegate({ super.onCreateWebView, - super.requestMediaCapturePermission, + required super.requestMediaCapturePermission, super.runJavaScriptAlertPanel, - super.runJavaScriptConfirmPanel, + required super.runJavaScriptConfirmPanel, super.runJavaScriptTextInputPanel, }) : super.pigeon_detached(pigeon_instanceManager: TestInstanceManager()) { lastCreatedDelegate = this; } - static CapturingUIDelegate lastCreatedDelegate = CapturingUIDelegate(); + static CapturingUIDelegate lastCreatedDelegate = CapturingUIDelegate( + requestMediaCapturePermission: (_, __, ___, ____, _____) async { + return PermissionDecision.deny; + }, + runJavaScriptConfirmPanel: (_, __, ___, ____) async { + return false; + }, + ); } class CapturingUIScrollViewDelegate extends UIScrollViewDelegate { diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart index 51b9e2ae9e4..59f32c8c453 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter_wkwebview/test/webkit_webview_controller_test.dart. // Do not manually edit this file. @@ -18,6 +18,7 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -25,150 +26,86 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; class _FakePigeonInstanceManager_0 extends _i1.SmartFake implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePigeonInstanceManager_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUIScrollView_1 extends _i1.SmartFake implements _i2.UIScrollView { - _FakeUIScrollView_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeUIScrollView_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeUIScrollViewDelegate_2 extends _i1.SmartFake implements _i2.UIScrollViewDelegate { - _FakeUIScrollViewDelegate_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeUIScrollViewDelegate_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeURL_3 extends _i1.SmartFake implements _i2.URL { - _FakeURL_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeURL_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeURLRequest_4 extends _i1.SmartFake implements _i2.URLRequest { - _FakeURLRequest_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeURLRequest_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKPreferences_5 extends _i1.SmartFake implements _i2.WKPreferences { - _FakeWKPreferences_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKPreferences_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKScriptMessageHandler_6 extends _i1.SmartFake implements _i2.WKScriptMessageHandler { - _FakeWKScriptMessageHandler_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKScriptMessageHandler_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKUserContentController_7 extends _i1.SmartFake implements _i2.WKUserContentController { - _FakeWKUserContentController_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKUserContentController_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKUserScript_8 extends _i1.SmartFake implements _i2.WKUserScript { - _FakeWKUserScript_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKUserScript_8(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKWebView_9 extends _i1.SmartFake implements _i2.WKWebView { - _FakeWKWebView_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebView_9(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_10 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { - _FakeWKWebsiteDataStore_10( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebsiteDataStore_10(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKWebViewConfiguration_11 extends _i1.SmartFake +class _FakeWKWebpagePreferences_11 extends _i1.SmartFake + implements _i2.WKWebpagePreferences { + _FakeWKWebpagePreferences_11(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeWKWebViewConfiguration_12 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { - _FakeWKWebViewConfiguration_11( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebViewConfiguration_12(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeUIViewWKWebView_12 extends _i1.SmartFake +class _FakeUIViewWKWebView_13 extends _i1.SmartFake implements _i2.UIViewWKWebView { - _FakeUIViewWKWebView_12( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeUIViewWKWebView_13(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKHTTPCookieStore_13 extends _i1.SmartFake +class _FakeWKHTTPCookieStore_14 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { - _FakeWKHTTPCookieStore_13( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKHTTPCookieStore_14(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [UIScrollView]. @@ -190,44 +127,24 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @override _i3.Future> getContentOffset() => (super.noSuchMethod( - Invocation.method( - #getContentOffset, - [], - ), + Invocation.method(#getContentOffset, []), returnValue: _i3.Future>.value([]), - returnValueForMissingStub: _i3.Future>.value([]), + returnValueForMissingStub: _i3.Future>.value( + [], + ), ) as _i3.Future>); @override - _i3.Future scrollBy( - double? x, - double? y, - ) => - (super.noSuchMethod( - Invocation.method( - #scrollBy, - [ - x, - y, - ], - ), + _i3.Future scrollBy(double? x, double? y) => (super.noSuchMethod( + Invocation.method(#scrollBy, [x, y]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future setContentOffset( - double? x, - double? y, - ) => + _i3.Future setContentOffset(double? x, double? y) => (super.noSuchMethod( - Invocation.method( - #setContentOffset, - [ - x, - y, - ], - ), + Invocation.method(#setContentOffset, [x, y]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -235,52 +152,70 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @override _i3.Future setDelegate(_i2.UIScrollViewDelegate? delegate) => (super.noSuchMethod( - Invocation.method( - #setDelegate, - [delegate], - ), + Invocation.method(#setDelegate, [delegate]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future setBounces(bool? value) => (super.noSuchMethod( + Invocation.method(#setBounces, [value]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future setBouncesHorizontally(bool? value) => (super.noSuchMethod( + Invocation.method(#setBouncesHorizontally, [value]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future setBouncesVertically(bool? value) => (super.noSuchMethod( + Invocation.method(#setBouncesVertically, [value]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future setAlwaysBounceVertical(bool? value) => (super.noSuchMethod( + Invocation.method(#setAlwaysBounceVertical, [value]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future setAlwaysBounceHorizontal(bool? value) => + (super.noSuchMethod( + Invocation.method(#setAlwaysBounceHorizontal, [value]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.UIScrollView pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeUIScrollView_1( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeUIScrollView_1( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.UIScrollView); @override _i3.Future setBackgroundColor(int? value) => (super.noSuchMethod( - Invocation.method( - #setBackgroundColor, - [value], - ), + Invocation.method(#setBackgroundColor, [value]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setOpaque(bool? opaque) => (super.noSuchMethod( - Invocation.method( - #setOpaque, - [opaque], - ), + Invocation.method(#setOpaque, [opaque]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -292,31 +227,15 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -342,23 +261,14 @@ class MockUIScrollViewDelegate extends _i1.Mock @override _i2.UIScrollViewDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeUIScrollViewDelegate_2( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeUIScrollViewDelegate_2( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.UIScrollViewDelegate); @@ -369,31 +279,15 @@ class MockUIScrollViewDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -418,46 +312,28 @@ class MockURL extends _i1.Mock implements _i2.URL { @override _i3.Future getAbsoluteString() => (super.noSuchMethod( - Invocation.method( - #getAbsoluteString, - [], - ), - returnValue: _i3.Future.value(_i4.dummyValue( - this, - Invocation.method( - #getAbsoluteString, - [], + Invocation.method(#getAbsoluteString, []), + returnValue: _i3.Future.value( + _i4.dummyValue( + this, + Invocation.method(#getAbsoluteString, []), ), - )), - returnValueForMissingStub: - _i3.Future.value(_i4.dummyValue( - this, - Invocation.method( - #getAbsoluteString, - [], + ), + returnValueForMissingStub: _i3.Future.value( + _i4.dummyValue( + this, + Invocation.method(#getAbsoluteString, []), ), - )), + ), ) as _i3.Future); @override _i2.URL pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeURL_3( - this, - Invocation.method( - #pigeon_copy, - [], - ), - ), + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURL_3(this, Invocation.method(#pigeon_copy, [])), returnValueForMissingStub: _FakeURL_3( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.URL); @@ -468,31 +344,15 @@ class MockURL extends _i1.Mock implements _i2.URL { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -517,50 +377,35 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @override _i3.Future getUrl() => (super.noSuchMethod( - Invocation.method( - #getUrl, - [], - ), + Invocation.method(#getUrl, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setHttpMethod(String? method) => (super.noSuchMethod( - Invocation.method( - #setHttpMethod, - [method], - ), + Invocation.method(#setHttpMethod, [method]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future getHttpMethod() => (super.noSuchMethod( - Invocation.method( - #getHttpMethod, - [], - ), + Invocation.method(#getHttpMethod, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setHttpBody(_i5.Uint8List? body) => (super.noSuchMethod( - Invocation.method( - #setHttpBody, - [body], - ), + Invocation.method(#setHttpBody, [body]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future<_i5.Uint8List?> getHttpBody() => (super.noSuchMethod( - Invocation.method( - #getHttpBody, - [], - ), + Invocation.method(#getHttpBody, []), returnValue: _i3.Future<_i5.Uint8List?>.value(), returnValueForMissingStub: _i3.Future<_i5.Uint8List?>.value(), ) as _i3.Future<_i5.Uint8List?>); @@ -568,10 +413,7 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @override _i3.Future setAllHttpHeaderFields(Map? fields) => (super.noSuchMethod( - Invocation.method( - #setAllHttpHeaderFields, - [fields], - ), + Invocation.method(#setAllHttpHeaderFields, [fields]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -579,33 +421,21 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @override _i3.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method( - #getAllHttpHeaderFields, - [], - ), + Invocation.method(#getAllHttpHeaderFields, []), returnValue: _i3.Future?>.value(), returnValueForMissingStub: _i3.Future?>.value(), ) as _i3.Future?>); @override _i2.URLRequest pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeURLRequest_4( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeURLRequest_4( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.URLRequest); @@ -616,31 +446,15 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -665,33 +479,21 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { @override _i3.Future setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method( - #setJavaScriptEnabled, - [enabled], - ), + Invocation.method(#setJavaScriptEnabled, [enabled]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.WKPreferences pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKPreferences_5( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeWKPreferences_5( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKPreferences); @@ -702,31 +504,15 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -775,23 +561,14 @@ class MockWKScriptMessageHandler extends _i1.Mock @override _i2.WKScriptMessageHandler pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKScriptMessageHandler_6( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeWKScriptMessageHandler_6( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKScriptMessageHandler); @@ -802,31 +579,15 @@ class MockWKScriptMessageHandler extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -856,13 +617,7 @@ class MockWKUserContentController extends _i1.Mock String? name, ) => (super.noSuchMethod( - Invocation.method( - #addScriptMessageHandler, - [ - handler, - name, - ], - ), + Invocation.method(#addScriptMessageHandler, [handler, name]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -870,20 +625,14 @@ class MockWKUserContentController extends _i1.Mock @override _i3.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( - Invocation.method( - #removeScriptMessageHandler, - [name], - ), + Invocation.method(#removeScriptMessageHandler, [name]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( - Invocation.method( - #removeAllScriptMessageHandlers, - [], - ), + Invocation.method(#removeAllScriptMessageHandlers, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -891,43 +640,28 @@ class MockWKUserContentController extends _i1.Mock @override _i3.Future addUserScript(_i2.WKUserScript? userScript) => (super.noSuchMethod( - Invocation.method( - #addUserScript, - [userScript], - ), + Invocation.method(#addUserScript, [userScript]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future removeAllUserScripts() => (super.noSuchMethod( - Invocation.method( - #removeAllUserScripts, - [], - ), + Invocation.method(#removeAllUserScripts, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.WKUserContentController pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKUserContentController_7( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeWKUserContentController_7( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKUserContentController); @@ -938,31 +672,15 @@ class MockWKUserContentController extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1014,23 +732,14 @@ class MockWKUserScript extends _i1.Mock implements _i2.WKUserScript { @override _i2.WKUserScript pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKUserScript_8( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeWKUserScript_8( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKUserScript); @@ -1041,31 +750,15 @@ class MockWKUserScript extends _i1.Mock implements _i2.WKUserScript { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1090,23 +783,14 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { @override _i2.WKWebView pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKWebView_9( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeWKWebView_9( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebView); @@ -1117,31 +801,15 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1167,12 +835,10 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future setUserContentController( - _i2.WKUserContentController? controller) => + _i2.WKUserContentController? controller, + ) => (super.noSuchMethod( - Invocation.method( - #setUserContentController, - [controller], - ), + Invocation.method(#setUserContentController, [controller]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1180,36 +846,26 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( - Invocation.method( - #getUserContentController, - [], - ), + Invocation.method(#getUserContentController, []), returnValue: _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_7( - this, - Invocation.method( - #getUserContentController, - [], + _FakeWKUserContentController_7( + this, + Invocation.method(#getUserContentController, []), ), - )), + ), returnValueForMissingStub: _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_7( - this, - Invocation.method( - #getUserContentController, - [], + _FakeWKUserContentController_7( + this, + Invocation.method(#getUserContentController, []), ), - )), + ), ) as _i3.Future<_i2.WKUserContentController>); @override _i3.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method( - #setWebsiteDataStore, - [dataStore], - ), + Invocation.method(#setWebsiteDataStore, [dataStore]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1217,69 +873,50 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( - Invocation.method( - #getWebsiteDataStore, - [], - ), - returnValue: - _i3.Future<_i2.WKWebsiteDataStore>.value(_FakeWKWebsiteDataStore_10( - this, - Invocation.method( - #getWebsiteDataStore, - [], + Invocation.method(#getWebsiteDataStore, []), + returnValue: _i3.Future<_i2.WKWebsiteDataStore>.value( + _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#getWebsiteDataStore, []), ), - )), - returnValueForMissingStub: - _i3.Future<_i2.WKWebsiteDataStore>.value(_FakeWKWebsiteDataStore_10( - this, - Invocation.method( - #getWebsiteDataStore, - [], + ), + returnValueForMissingStub: _i3.Future<_i2.WKWebsiteDataStore>.value( + _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#getWebsiteDataStore, []), ), - )), + ), ) as _i3.Future<_i2.WKWebsiteDataStore>); @override _i3.Future setPreferences(_i2.WKPreferences? preferences) => (super.noSuchMethod( - Invocation.method( - #setPreferences, - [preferences], - ), + Invocation.method(#setPreferences, [preferences]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future<_i2.WKPreferences> getPreferences() => (super.noSuchMethod( - Invocation.method( - #getPreferences, - [], - ), - returnValue: _i3.Future<_i2.WKPreferences>.value(_FakeWKPreferences_5( - this, - Invocation.method( - #getPreferences, - [], + Invocation.method(#getPreferences, []), + returnValue: _i3.Future<_i2.WKPreferences>.value( + _FakeWKPreferences_5( + this, + Invocation.method(#getPreferences, []), ), - )), - returnValueForMissingStub: - _i3.Future<_i2.WKPreferences>.value(_FakeWKPreferences_5( - this, - Invocation.method( - #getPreferences, - [], + ), + returnValueForMissingStub: _i3.Future<_i2.WKPreferences>.value( + _FakeWKPreferences_5( + this, + Invocation.method(#getPreferences, []), ), - )), + ), ) as _i3.Future<_i2.WKPreferences>); @override _i3.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( - Invocation.method( - #setAllowsInlineMediaPlayback, - [allow], - ), + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1287,45 +924,51 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method( - #setLimitsNavigationsToAppBoundDomains, - [limit], - ), + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setMediaTypesRequiringUserActionForPlayback( - _i2.AudiovisualMediaType? type) => + _i2.AudiovisualMediaType? type, + ) => (super.noSuchMethod( - Invocation.method( - #setMediaTypesRequiringUserActionForPlayback, - [type], - ), + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], + _i3.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => + (super.noSuchMethod( + Invocation.method(#getDefaultWebpagePreferences, []), + returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_11( + this, + Invocation.method(#getDefaultWebpagePreferences, []), + ), ), - returnValue: _FakeWKWebViewConfiguration_11( - this, - Invocation.method( - #pigeon_copy, - [], + returnValueForMissingStub: _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_11( + this, + Invocation.method(#getDefaultWebpagePreferences, []), ), ), - returnValueForMissingStub: _FakeWKWebViewConfiguration_11( + ) as _i3.Future<_i2.WKWebpagePreferences>); + + @override + _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebViewConfiguration_12( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKWebViewConfiguration_12( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebViewConfiguration); @@ -1336,31 +979,75 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], + Invocation.method(#addObserver, [observer, keyPath, options]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => + (super.noSuchMethod( + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); +} + +/// A class which mocks [WKWebpagePreferences]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockWKWebpagePreferences extends _i1.Mock + implements _i2.WKWebpagePreferences { + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), ), + returnValueForMissingStub: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i3.Future setAllowsContentJavaScript(bool? allow) => + (super.noSuchMethod( + Invocation.method(#setAllowsContentJavaScript, [allow]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( + _i2.WKWebpagePreferences pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebpagePreferences_11( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKWebpagePreferences_11( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebpagePreferences); + + @override + _i3.Future addObserver( _i2.NSObject? observer, String? keyPath, + List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => + (super.noSuchMethod( + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1373,11 +1060,11 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i2.WKWebViewConfiguration get configuration => (super.noSuchMethod( Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_11( + returnValue: _FakeWKWebViewConfiguration_12( this, Invocation.getter(#configuration), ), - returnValueForMissingStub: _FakeWKWebViewConfiguration_11( + returnValueForMissingStub: _FakeWKWebViewConfiguration_12( this, Invocation.getter(#configuration), ), @@ -1411,55 +1098,34 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i2.WKWebViewConfiguration pigeonVar_configuration() => (super.noSuchMethod( - Invocation.method( - #pigeonVar_configuration, - [], - ), - returnValue: _FakeWKWebViewConfiguration_11( + Invocation.method(#pigeonVar_configuration, []), + returnValue: _FakeWKWebViewConfiguration_12( this, - Invocation.method( - #pigeonVar_configuration, - [], - ), + Invocation.method(#pigeonVar_configuration, []), ), - returnValueForMissingStub: _FakeWKWebViewConfiguration_11( + returnValueForMissingStub: _FakeWKWebViewConfiguration_12( this, - Invocation.method( - #pigeonVar_configuration, - [], - ), + Invocation.method(#pigeonVar_configuration, []), ), ) as _i2.WKWebViewConfiguration); @override _i2.UIScrollView pigeonVar_scrollView() => (super.noSuchMethod( - Invocation.method( - #pigeonVar_scrollView, - [], - ), + Invocation.method(#pigeonVar_scrollView, []), returnValue: _FakeUIScrollView_1( this, - Invocation.method( - #pigeonVar_scrollView, - [], - ), + Invocation.method(#pigeonVar_scrollView, []), ), returnValueForMissingStub: _FakeUIScrollView_1( this, - Invocation.method( - #pigeonVar_scrollView, - [], - ), + Invocation.method(#pigeonVar_scrollView, []), ), ) as _i2.UIScrollView); @override _i3.Future setUIDelegate(_i2.WKUIDelegate? delegate) => (super.noSuchMethod( - Invocation.method( - #setUIDelegate, - [delegate], - ), + Invocation.method(#setUIDelegate, [delegate]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1467,144 +1133,93 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i3.Future setNavigationDelegate(_i2.WKNavigationDelegate? delegate) => (super.noSuchMethod( - Invocation.method( - #setNavigationDelegate, - [delegate], - ), + Invocation.method(#setNavigationDelegate, [delegate]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future getUrl() => (super.noSuchMethod( - Invocation.method( - #getUrl, - [], - ), + Invocation.method(#getUrl, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future getEstimatedProgress() => (super.noSuchMethod( - Invocation.method( - #getEstimatedProgress, - [], - ), + Invocation.method(#getEstimatedProgress, []), returnValue: _i3.Future.value(0.0), returnValueForMissingStub: _i3.Future.value(0.0), ) as _i3.Future); @override _i3.Future load(_i2.URLRequest? request) => (super.noSuchMethod( - Invocation.method( - #load, - [request], - ), + Invocation.method(#load, [request]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future loadHtmlString( - String? string, - String? baseUrl, - ) => + _i3.Future loadHtmlString(String? string, String? baseUrl) => (super.noSuchMethod( - Invocation.method( - #loadHtmlString, - [ - string, - baseUrl, - ], - ), + Invocation.method(#loadHtmlString, [string, baseUrl]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future loadFileUrl( - String? url, - String? readAccessUrl, - ) => + _i3.Future loadFileUrl(String? url, String? readAccessUrl) => (super.noSuchMethod( - Invocation.method( - #loadFileUrl, - [ - url, - readAccessUrl, - ], - ), + Invocation.method(#loadFileUrl, [url, readAccessUrl]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future loadFlutterAsset(String? key) => (super.noSuchMethod( - Invocation.method( - #loadFlutterAsset, - [key], - ), + Invocation.method(#loadFlutterAsset, [key]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future canGoBack() => (super.noSuchMethod( - Invocation.method( - #canGoBack, - [], - ), + Invocation.method(#canGoBack, []), returnValue: _i3.Future.value(false), returnValueForMissingStub: _i3.Future.value(false), ) as _i3.Future); @override _i3.Future canGoForward() => (super.noSuchMethod( - Invocation.method( - #canGoForward, - [], - ), + Invocation.method(#canGoForward, []), returnValue: _i3.Future.value(false), returnValueForMissingStub: _i3.Future.value(false), ) as _i3.Future); @override _i3.Future goBack() => (super.noSuchMethod( - Invocation.method( - #goBack, - [], - ), + Invocation.method(#goBack, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future goForward() => (super.noSuchMethod( - Invocation.method( - #goForward, - [], - ), + Invocation.method(#goForward, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future reload() => (super.noSuchMethod( - Invocation.method( - #reload, - [], - ), + Invocation.method(#reload, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future getTitle() => (super.noSuchMethod( - Invocation.method( - #getTitle, - [], - ), + Invocation.method(#getTitle, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1612,20 +1227,14 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i3.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( - Invocation.method( - #setAllowsBackForwardNavigationGestures, - [allow], - ), + Invocation.method(#setAllowsBackForwardNavigationGestures, [allow]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod( - Invocation.method( - #setCustomUserAgent, - [userAgent], - ), + Invocation.method(#setCustomUserAgent, [userAgent]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1633,72 +1242,48 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i3.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( - Invocation.method( - #evaluateJavaScript, - [javaScriptString], - ), + Invocation.method(#evaluateJavaScript, [javaScriptString]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setInspectable(bool? inspectable) => (super.noSuchMethod( - Invocation.method( - #setInspectable, - [inspectable], - ), + Invocation.method(#setInspectable, [inspectable]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future getCustomUserAgent() => (super.noSuchMethod( - Invocation.method( - #getCustomUserAgent, - [], - ), + Invocation.method(#getCustomUserAgent, []), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.UIViewWKWebView pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeUIViewWKWebView_12( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIViewWKWebView_13( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), - returnValueForMissingStub: _FakeUIViewWKWebView_12( + returnValueForMissingStub: _FakeUIViewWKWebView_13( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.UIViewWKWebView); @override _i3.Future setBackgroundColor(int? value) => (super.noSuchMethod( - Invocation.method( - #setBackgroundColor, - [value], - ), + Invocation.method(#setBackgroundColor, [value]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setOpaque(bool? opaque) => (super.noSuchMethod( - Invocation.method( - #setOpaque, - [opaque], - ), + Invocation.method(#setOpaque, [opaque]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1710,31 +1295,15 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -1748,11 +1317,11 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_13( + returnValue: _FakeWKHTTPCookieStore_14( this, Invocation.getter(#httpCookieStore), ), - returnValueForMissingStub: _FakeWKHTTPCookieStore_13( + returnValueForMissingStub: _FakeWKHTTPCookieStore_14( this, Invocation.getter(#httpCookieStore), ), @@ -1773,23 +1342,14 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), - returnValue: _FakeWKHTTPCookieStore_13( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_14( this, - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), + Invocation.method(#pigeonVar_httpCookieStore, []), ), - returnValueForMissingStub: _FakeWKHTTPCookieStore_13( + returnValueForMissingStub: _FakeWKHTTPCookieStore_14( this, - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), + Invocation.method(#pigeonVar_httpCookieStore, []), ), ) as _i2.WKHTTPCookieStore); @@ -1799,36 +1359,24 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method( - #removeDataOfTypes, - [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ], - ), + Invocation.method(#removeDataOfTypes, [ + dataTypes, + modificationTimeInSecondsSinceEpoch, + ]), returnValue: _i3.Future.value(false), returnValueForMissingStub: _i3.Future.value(false), ) as _i3.Future); @override _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKWebsiteDataStore_10( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), returnValueForMissingStub: _FakeWKWebsiteDataStore_10( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebsiteDataStore); @@ -1839,31 +1387,15 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.mocks.dart index ce95b63531d..d494fbba209 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.dart. // Do not manually edit this file. @@ -16,6 +16,7 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -23,35 +24,20 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; class _FakeWKHTTPCookieStore_0 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { - _FakeWKHTTPCookieStore_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKHTTPCookieStore_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakePigeonInstanceManager_1 extends _i1.SmartFake implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePigeonInstanceManager_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_2 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { - _FakeWKWebsiteDataStore_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebsiteDataStore_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [WKWebsiteDataStore]. @@ -83,16 +69,10 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), + Invocation.method(#pigeonVar_httpCookieStore, []), returnValue: _FakeWKHTTPCookieStore_0( this, - Invocation.method( - #pigeonVar_httpCookieStore, - [], - ), + Invocation.method(#pigeonVar_httpCookieStore, []), ), ) as _i2.WKHTTPCookieStore); @@ -102,28 +82,19 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method( - #removeDataOfTypes, - [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ], - ), + Invocation.method(#removeDataOfTypes, [ + dataTypes, + modificationTimeInSecondsSinceEpoch, + ]), returnValue: _i3.Future.value(false), ) as _i3.Future); @override _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKWebsiteDataStore_2( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebsiteDataStore); @@ -134,31 +105,15 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -183,26 +138,17 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { @override _i3.Future setCookie(_i2.HTTPCookie? cookie) => (super.noSuchMethod( - Invocation.method( - #setCookie, - [cookie], - ), + Invocation.method(#setCookie, [cookie]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.WKHTTPCookieStore pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKHTTPCookieStore_0( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKHTTPCookieStore); @@ -213,31 +159,15 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.mocks.dart index b99d333513d..ce4ab60e4a0 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.4 from annotations +// Mocks generated by Mockito 5.4.5 from annotations // in webview_flutter_wkwebview/test/webkit_webview_widget_test.dart. // Do not manually edit this file. @@ -16,6 +16,7 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member +// ignore_for_file: must_be_immutable // ignore_for_file: prefer_const_constructors // ignore_for_file: unnecessary_parenthesis // ignore_for_file: camel_case_types @@ -23,77 +24,48 @@ import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; class _FakePigeonInstanceManager_0 extends _i1.SmartFake implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakePigeonInstanceManager_0(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKUIDelegate_1 extends _i1.SmartFake implements _i2.WKUIDelegate { - _FakeWKUIDelegate_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKUIDelegate_1(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKUserContentController_2 extends _i1.SmartFake implements _i2.WKUserContentController { - _FakeWKUserContentController_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKUserContentController_2(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_3 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { - _FakeWKWebsiteDataStore_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebsiteDataStore_3(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } class _FakeWKPreferences_4 extends _i1.SmartFake implements _i2.WKPreferences { - _FakeWKPreferences_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKPreferences_4(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeWKWebViewConfiguration_5 extends _i1.SmartFake +class _FakeWKWebpagePreferences_5 extends _i1.SmartFake + implements _i2.WKWebpagePreferences { + _FakeWKWebpagePreferences_5(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); +} + +class _FakeWKWebViewConfiguration_6 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { - _FakeWKWebViewConfiguration_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeWKWebViewConfiguration_6(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } -class _FakeUIScrollViewDelegate_6 extends _i1.SmartFake +class _FakeUIScrollViewDelegate_7 extends _i1.SmartFake implements _i2.UIScrollViewDelegate { - _FakeUIScrollViewDelegate_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); + _FakeUIScrollViewDelegate_7(Object parent, Invocation parentInvocation) + : super(parent, parentInvocation); } /// A class which mocks [WKUIDelegate]. @@ -104,6 +76,55 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { _i1.throwOnMissingStub(this); } + @override + _i3.Future<_i2.PermissionDecision> Function( + _i2.WKUIDelegate, + _i2.WKWebView, + _i2.WKSecurityOrigin, + _i2.WKFrameInfo, + _i2.MediaCaptureType, + ) get requestMediaCapturePermission => (super.noSuchMethod( + Invocation.getter(#requestMediaCapturePermission), + returnValue: ( + _i2.WKUIDelegate pigeon_instance, + _i2.WKWebView webView, + _i2.WKSecurityOrigin origin, + _i2.WKFrameInfo frame, + _i2.MediaCaptureType type, + ) => + _i3.Future<_i2.PermissionDecision>.value( + _i2.PermissionDecision.deny, + ), + ) as _i3.Future<_i2.PermissionDecision> Function( + _i2.WKUIDelegate, + _i2.WKWebView, + _i2.WKSecurityOrigin, + _i2.WKFrameInfo, + _i2.MediaCaptureType, + )); + + @override + _i3.Future Function( + _i2.WKUIDelegate, + _i2.WKWebView, + String, + _i2.WKFrameInfo, + ) get runJavaScriptConfirmPanel => (super.noSuchMethod( + Invocation.getter(#runJavaScriptConfirmPanel), + returnValue: ( + _i2.WKUIDelegate pigeon_instance, + _i2.WKWebView webView, + String message, + _i2.WKFrameInfo frame, + ) => + _i3.Future.value(false), + ) as _i3.Future Function( + _i2.WKUIDelegate, + _i2.WKWebView, + String, + _i2.WKFrameInfo, + )); + @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), @@ -115,16 +136,10 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { @override _i2.WKUIDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), returnValue: _FakeWKUIDelegate_1( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKUIDelegate); @@ -135,31 +150,15 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -185,12 +184,10 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future setUserContentController( - _i2.WKUserContentController? controller) => + _i2.WKUserContentController? controller, + ) => (super.noSuchMethod( - Invocation.method( - #setUserContentController, - [controller], - ), + Invocation.method(#setUserContentController, [controller]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -198,27 +195,19 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( - Invocation.method( - #getUserContentController, - [], - ), + Invocation.method(#getUserContentController, []), returnValue: _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_2( - this, - Invocation.method( - #getUserContentController, - [], + _FakeWKUserContentController_2( + this, + Invocation.method(#getUserContentController, []), ), - )), + ), ) as _i3.Future<_i2.WKUserContentController>); @override _i3.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method( - #setWebsiteDataStore, - [dataStore], - ), + Invocation.method(#setWebsiteDataStore, [dataStore]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -226,53 +215,38 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( - Invocation.method( - #getWebsiteDataStore, - [], - ), - returnValue: - _i3.Future<_i2.WKWebsiteDataStore>.value(_FakeWKWebsiteDataStore_3( - this, - Invocation.method( - #getWebsiteDataStore, - [], + Invocation.method(#getWebsiteDataStore, []), + returnValue: _i3.Future<_i2.WKWebsiteDataStore>.value( + _FakeWKWebsiteDataStore_3( + this, + Invocation.method(#getWebsiteDataStore, []), ), - )), + ), ) as _i3.Future<_i2.WKWebsiteDataStore>); @override _i3.Future setPreferences(_i2.WKPreferences? preferences) => (super.noSuchMethod( - Invocation.method( - #setPreferences, - [preferences], - ), + Invocation.method(#setPreferences, [preferences]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future<_i2.WKPreferences> getPreferences() => (super.noSuchMethod( - Invocation.method( - #getPreferences, - [], - ), - returnValue: _i3.Future<_i2.WKPreferences>.value(_FakeWKPreferences_4( - this, - Invocation.method( - #getPreferences, - [], + Invocation.method(#getPreferences, []), + returnValue: _i3.Future<_i2.WKPreferences>.value( + _FakeWKPreferences_4( + this, + Invocation.method(#getPreferences, []), ), - )), + ), ) as _i3.Future<_i2.WKPreferences>); @override _i3.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( - Invocation.method( - #setAllowsInlineMediaPlayback, - [allow], - ), + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -280,38 +254,41 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method( - #setLimitsNavigationsToAppBoundDomains, - [limit], - ), + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future setMediaTypesRequiringUserActionForPlayback( - _i2.AudiovisualMediaType? type) => + _i2.AudiovisualMediaType? type, + ) => (super.noSuchMethod( - Invocation.method( - #setMediaTypesRequiringUserActionForPlayback, - [type], - ), + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], + _i3.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => + (super.noSuchMethod( + Invocation.method(#getDefaultWebpagePreferences, []), + returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_5( + this, + Invocation.method(#getDefaultWebpagePreferences, []), + ), ), - returnValue: _FakeWKWebViewConfiguration_5( + ) as _i3.Future<_i2.WKWebpagePreferences>); + + @override + _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebViewConfiguration_6( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.WKWebViewConfiguration); @@ -322,31 +299,15 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -372,16 +333,10 @@ class MockUIScrollViewDelegate extends _i1.Mock @override _i2.UIScrollViewDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method( - #pigeon_copy, - [], - ), - returnValue: _FakeUIScrollViewDelegate_6( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollViewDelegate_7( this, - Invocation.method( - #pigeon_copy, - [], - ), + Invocation.method(#pigeon_copy, []), ), ) as _i2.UIScrollViewDelegate); @@ -392,31 +347,15 @@ class MockUIScrollViewDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method( - #addObserver, - [ - observer, - keyPath, - options, - ], - ), + Invocation.method(#addObserver, [observer, keyPath, options]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future removeObserver( - _i2.NSObject? observer, - String? keyPath, - ) => + _i3.Future removeObserver(_i2.NSObject? observer, String? keyPath) => (super.noSuchMethod( - Invocation.method( - #removeObserver, - [ - observer, - keyPath, - ], - ), + Invocation.method(#removeObserver, [observer, keyPath]), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future);