From 84edf6fb75a82950deaef3f9e02b87f184143287 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 22 Apr 2025 15:30:21 -0400 Subject: [PATCH 01/34] add interface portion --- .../lib/src/platform_navigation_delegate.dart | 12 +++++++ .../lib/src/platform_ssl_auth_request.dart | 36 +++++++++++++++++++ .../lib/src/types/ssl_certificate.dart | 20 +++++++++++ .../lib/src/types/ssl_error.dart | 15 ++++++++ .../lib/src/types/types.dart | 2 ++ 5 files changed, 85 insertions(+) create mode 100644 packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart create mode 100644 packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_certificate.dart create mode 100644 packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_error.dart diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart index 38cf7c19a2d5..7b949624067c 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart @@ -6,6 +6,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; +import 'platform_ssl_auth_request.dart'; import 'types/types.dart'; import 'webview_platform.dart' show WebViewPlatform; @@ -34,6 +35,10 @@ typedef UrlChangeCallback = void Function(UrlChange change); /// authentication request. typedef HttpAuthRequestCallback = void Function(HttpAuthRequest request); +/// Signature for callbacks that notify the host application of an +/// SSL authentication request. +typedef SslAuthRequestCallback = void Function(PlatformSslAuthRequest request); + /// An interface defining navigation events that occur on the native platform. /// /// The [PlatformWebViewController] is notifying this delegate on events that @@ -143,4 +148,11 @@ abstract class PlatformNavigationDelegate extends PlatformInterface { 'setOnHttpAuthRequest is not implemented on the current platform.', ); } + + /// Invoked when the web view requests a response to an SSL error. + Future setOnSSlAuthRequest(SslAuthRequestCallback onSslAuthRequest) { + throw UnimplementedError( + 'setOnSSlAuthRequest is not implemented on the current platform.', + ); + } } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart new file mode 100644 index 000000000000..8ced02faf1a0 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart @@ -0,0 +1,36 @@ +// 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 'package:flutter/foundation.dart'; + +import 'types/types.dart'; + +/// A request from a server to respond to a set of one or more SSL errors with +/// the associated SSL certificate. +/// +/// The host application must call [cancel] or, contrary to secure web +/// communication standards, [proceed] to provide the web view's response to the +/// request. +abstract class PlatformSslAuthRequest { + /// Creates a [PlatformSslAuthRequest]. + @protected + PlatformSslAuthRequest({ + required this.certificates, + this.url, + }); + + /// A list of certificates associated with this request. + final List certificates; + + /// The URL associated with the request. + final Uri? url; + + /// Instructs the WebView that encountered the SSL certificate error to ignore + /// the error and continue communicating with the server. + Future proceed(); + + /// Instructs the WebView that encountered the SSL certificate error to + /// terminate communication with the server. + Future cancel(); +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_certificate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_certificate.dart new file mode 100644 index 000000000000..496bb3632da8 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_certificate.dart @@ -0,0 +1,20 @@ +// 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 'package:flutter/foundation.dart'; + +import 'ssl_error.dart'; + +/// Provides the details for an SSL certificate. +@immutable +class SslCertificate { + /// Creates a [SslCertificate]. + const SslCertificate({this.data, this.errors = const []}); + + /// The encoded form of this certificate. + final Uint8List? data; + + /// A list of errors associated with this certificate. + final List errors; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_error.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_error.dart new file mode 100644 index 000000000000..b07fbd6c0141 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_error.dart @@ -0,0 +1,15 @@ +// 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 'package:flutter/foundation.dart'; + +/// Provides the details for an SSl certificate error. +@immutable +class SslError { + /// Creates an [SslError]. + const SslError({required this.description}); + + /// A human-presentable description for a given error. + final String description; +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart index 937b44a13a85..731cca24bf2f 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart @@ -19,6 +19,8 @@ export 'platform_webview_cookie_manager_creation_params.dart'; export 'platform_webview_permission_request.dart'; export 'platform_webview_widget_creation_params.dart'; export 'scroll_position_change.dart'; +export 'ssl_certificate.dart'; +export 'ssl_error.dart'; export 'url_change.dart'; export 'web_resource_error.dart'; export 'web_resource_request.dart'; From 77354390fb6373f2efebc9058e96836157bfca7d Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 22 Apr 2025 15:32:21 -0400 Subject: [PATCH 02/34] update dependencies --- .../webview_flutter/webview_flutter/example/pubspec.yaml | 6 ++++++ packages/webview_flutter/webview_flutter/pubspec.yaml | 6 ++++++ .../webview_flutter_android/example/pubspec.yaml | 4 ++++ .../webview_flutter/webview_flutter_android/pubspec.yaml | 4 ++++ .../webview_flutter_wkwebview/example/pubspec.yaml | 4 ++++ .../webview_flutter/webview_flutter_wkwebview/pubspec.yaml | 4 ++++ 6 files changed, 28 insertions(+) diff --git a/packages/webview_flutter/webview_flutter/example/pubspec.yaml b/packages/webview_flutter/webview_flutter/example/pubspec.yaml index 5c0fb7ecf999..8e37ba236135 100644 --- a/packages/webview_flutter/webview_flutter/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/example/pubspec.yaml @@ -36,3 +36,9 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + webview_flutter_android: {path: ../../../../packages/webview_flutter/webview_flutter_android} + webview_flutter_platform_interface: {path: ../../../../packages/webview_flutter/webview_flutter_platform_interface} + webview_flutter_wkwebview: {path: ../../../../packages/webview_flutter/webview_flutter_wkwebview} diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml index c609edc11ff4..6592e978394f 100644 --- a/packages/webview_flutter/webview_flutter/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter/pubspec.yaml @@ -36,3 +36,9 @@ topics: - html - webview - webview-flutter +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + webview_flutter_android: {path: ../../../packages/webview_flutter/webview_flutter_android} + webview_flutter_platform_interface: {path: ../../../packages/webview_flutter/webview_flutter_platform_interface} + webview_flutter_wkwebview: {path: ../../../packages/webview_flutter/webview_flutter_wkwebview} diff --git a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml index de6c69e78064..0fb5a2af64aa 100644 --- a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml @@ -33,3 +33,7 @@ flutter: - assets/sample_video.mp4 - assets/www/index.html - assets/www/styles/style.css +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + webview_flutter_platform_interface: {path: ../../../../packages/webview_flutter/webview_flutter_platform_interface} diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 39bb1c63dda9..21e45198c78e 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -33,3 +33,7 @@ topics: - html - webview - webview-flutter +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + webview_flutter_platform_interface: {path: ../../../packages/webview_flutter/webview_flutter_platform_interface} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml index fa7f2114200e..23fa31f4d5af 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml @@ -34,3 +34,7 @@ flutter: - assets/www/styles/style.css # Test certificate used to create a test native `SecTrust`. - assets/test_cert.der +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + webview_flutter_platform_interface: {path: ../../../../packages/webview_flutter/webview_flutter_platform_interface} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 64bf86387d49..e4ade0e83249 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -38,3 +38,7 @@ topics: - html - webview - webview-flutter +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/blob/master/docs/ecosystem/contributing/README.md#changing-federated-plugins +dependency_overrides: + webview_flutter_platform_interface: {path: ../../../packages/webview_flutter/webview_flutter_platform_interface} From 2a8cf7ce8207de0d6f1e4377841e73f3cc8159b9 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 22 Apr 2025 22:40:51 -0400 Subject: [PATCH 03/34] android impl without tests --- .../webviewflutter/AndroidWebkitLibrary.g.kt | 4107 +++++++---------- .../lib/src/android_ssl_auth_request.dart | 52 + .../lib/src/android_webkit.g.dart | 118 +- .../lib/src/android_webview_controller.dart | 28 +- .../pigeons/android_webkit.dart | 15 +- .../webview_flutter_platform_interface.dart | 1 + 6 files changed, 1831 insertions(+), 2490 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt index fdbbd259af39..ca03e7bee038 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt @@ -1,72 +1,76 @@ // 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 (v25.3.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.1), do not edit directly. // See also: https://pub.dev/packages/pigeon -@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass", "SyntheticAccessor") +@file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") package io.flutter.plugins.webviewflutter import android.util.Log import io.flutter.plugin.common.BasicMessageChannel import io.flutter.plugin.common.BinaryMessenger +import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.MessageCodec +import io.flutter.plugin.common.StandardMethodCodec import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer +private object AndroidWebkitLibraryPigeonUtils { -private fun wrapResult(result: Any?): List { - return listOf(result) -} + fun createConnectionError(channelName: String): AndroidWebKitError { + return AndroidWebKitError("channel-error", "Unable to establish connection on channel: '$channelName'.", "") } + + fun wrapResult(result: Any?): List { + return listOf(result) + } -private fun wrapError(exception: Throwable): List { - return if (exception is AndroidWebKitError) { - listOf(exception.code, exception.message, exception.details) - } else { - listOf( + fun wrapError(exception: Throwable): List { + return if (exception is AndroidWebKitError) { + listOf( + exception.code, + exception.message, + exception.details + ) + } else { + listOf( exception.javaClass.simpleName, exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) + ) + } } } -private fun createConnectionError(channelName: String): AndroidWebKitError { - return AndroidWebKitError( - "channel-error", "Unable to establish connection on channel: '$channelName'.", "") -} - /** * Error class for passing custom error details to Flutter via a thrown PlatformException. - * * @property code The error code. * @property message The error message. * @property details The error details. Must be a datatype supported by the api codec. */ -class AndroidWebKitError( - val code: String, - override val message: String? = null, - val details: Any? = null +class AndroidWebKitError ( + val code: String, + override val message: String? = null, + val details: Any? = null ) : Throwable() /** * Maintains instances used to communicate with the corresponding objects in Dart. * - * Objects stored in this container are represented by an object in Dart that is also stored in an - * InstanceManager with the same identifier. + * Objects stored in this container are represented by an object in Dart that is also stored in + * an InstanceManager with the same identifier. * * When an instance is added with an identifier, either can be used to retrieve the other. * - * Added instances are added as a weak reference and a strong reference. When the strong reference - * is removed with [remove] and the weak reference is deallocated, the - * `finalizationListener.onFinalize` is called with the instance's identifier. However, if the - * strong reference is removed and then the identifier is retrieved with the intention to pass the - * identifier to Dart (e.g. calling [getIdentifierForStrongReference]), the strong reference to the - * instance is recreated. The strong reference will then need to be removed manually again. + * Added instances are added as a weak reference and a strong reference. When the strong + * reference is removed with [remove] and the weak reference is deallocated, the + * `finalizationListener.onFinalize` is called with the instance's identifier. However, if the strong + * reference is removed and then the identifier is retrieved with the intention to pass the identifier + * to Dart (e.g. calling [getIdentifierForStrongReference]), the strong reference to the instance + * is recreated. The strong reference will then need to be removed manually again. */ @Suppress("UNCHECKED_CAST", "MemberVisibilityCanBePrivate") -class AndroidWebkitLibraryPigeonInstanceManager( - private val finalizationListener: PigeonFinalizationListener -) { - /** Interface for listening when a weak reference of an instance is removed from the manager. */ +class AndroidWebkitLibraryPigeonInstanceManager(private val finalizationListener: PigeonFinalizationListener) { + /** Interface for listening when a weak reference of an instance is removed from the manager. */ interface PigeonFinalizationListener { fun onFinalize(identifier: Long) } @@ -77,6 +81,9 @@ class AndroidWebkitLibraryPigeonInstanceManager( private val referenceQueue = java.lang.ref.ReferenceQueue() private val weakReferencesToIdentifiers = HashMap, Long>() private val handler = android.os.Handler(android.os.Looper.getMainLooper()) + private val releaseAllFinalizedInstancesRunnable = Runnable { + this.releaseAllFinalizedInstances() + } private var nextIdentifier: Long = minHostCreatedIdentifier private var hasFinalizationListenerStopped = false @@ -86,13 +93,13 @@ class AndroidWebkitLibraryPigeonInstanceManager( */ var clearFinalizedWeakReferencesInterval: Long = 3000 set(value) { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) field = value releaseAllFinalizedInstances() } init { - handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } companion object { @@ -104,40 +111,37 @@ class AndroidWebkitLibraryPigeonInstanceManager( private const val tag = "PigeonInstanceManager" /** - * Instantiate a new manager with a listener for garbage collected weak references. + * Instantiate a new manager with a listener for garbage collected weak + * references. * * When the manager is no longer needed, [stopFinalizationListener] must be called. */ - fun create( - finalizationListener: PigeonFinalizationListener - ): AndroidWebkitLibraryPigeonInstanceManager { + fun create(finalizationListener: PigeonFinalizationListener): AndroidWebkitLibraryPigeonInstanceManager { return AndroidWebkitLibraryPigeonInstanceManager(finalizationListener) } } /** - * Removes `identifier` and return its associated strongly referenced instance, if present, from - * the manager. + * Removes `identifier` and return its associated strongly referenced instance, if present, + * from the manager. */ fun remove(identifier: Long): T? { logWarningIfFinalizationListenerHasStopped() - val instance: Any? = getInstance(identifier) - if (instance is WebViewProxyApi.WebViewPlatformView) { - instance.destroy() - } return strongInstances.remove(identifier) as T? } /** * Retrieves the identifier paired with an instance, if present, otherwise `null`. * + * * If the manager contains a strong reference to `instance`, it will return the identifier * associated with `instance`. If the manager contains only a weak reference to `instance`, a new * strong reference to `instance` will be added and will need to be removed again with [remove]. * + * * If this method returns a nonnull identifier, this method also expects the Dart - * `AndroidWebkitLibraryPigeonInstanceManager` to have, or recreate, a weak reference to the Dart - * instance the identifier is associated with. + * `AndroidWebkitLibraryPigeonInstanceManager` to have, or recreate, a weak reference to the Dart instance the + * identifier is associated with. */ fun getIdentifierForStrongReference(instance: Any?): Long? { logWarningIfFinalizationListenerHasStopped() @@ -151,9 +155,9 @@ class AndroidWebkitLibraryPigeonInstanceManager( /** * Adds a new instance that was instantiated from Dart. * - * The same instance can be added multiple times, but each identifier must be unique. This allows - * two objects that are equivalent (e.g. the `equals` method returns true and their hashcodes are - * equal) to both be added. + * The same instance can be added multiple times, but each identifier must be unique. This + * allows two objects that are equivalent (e.g. the `equals` method returns true and their + * hashcodes are equal) to both be added. * * [identifier] must be >= 0 and unique. */ @@ -165,13 +169,13 @@ class AndroidWebkitLibraryPigeonInstanceManager( /** * Adds a new unique instance that was instantiated from the host platform. * - * [identifier] must be >= 0 and unique. + * If the manager contains [instance], this returns the corresponding identifier. If the + * manager does not contain [instance], this adds the instance and returns a unique + * identifier for that [instance]. */ fun addHostCreatedInstance(instance: Any): Long { logWarningIfFinalizationListenerHasStopped() - require(!containsInstance(instance)) { - "Instance of ${instance.javaClass} has already been added." - } + require(!containsInstance(instance)) { "Instance of ${instance.javaClass} has already been added." } val identifier = nextIdentifier++ addInstance(instance, identifier) return identifier @@ -198,7 +202,7 @@ class AndroidWebkitLibraryPigeonInstanceManager( * longer be called and methods will log a warning. */ fun stopFinalizationListener() { - handler.removeCallbacks { this.releaseAllFinalizedInstances() } + handler.removeCallbacks(releaseAllFinalizedInstancesRunnable) hasFinalizationListenerStopped = true } @@ -229,8 +233,7 @@ class AndroidWebkitLibraryPigeonInstanceManager( return } var reference: java.lang.ref.WeakReference? - while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } != - null) { + while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } != null) { val identifier = weakReferencesToIdentifiers.remove(reference) if (identifier != null) { weakInstances.remove(identifier) @@ -238,7 +241,7 @@ class AndroidWebkitLibraryPigeonInstanceManager( finalizationListener.onFinalize(identifier) } } - handler.postDelayed({ releaseAllFinalizedInstances() }, clearFinalizedWeakReferencesInterval) + handler.postDelayed(releaseAllFinalizedInstancesRunnable, clearFinalizedWeakReferencesInterval) } private fun addInstance(instance: Any, identifier: Long) { @@ -256,43 +259,39 @@ class AndroidWebkitLibraryPigeonInstanceManager( private fun logWarningIfFinalizationListenerHasStopped() { if (hasFinalizationListenerStopped()) { Log.w( - tag, - "The manager was used after calls to the PigeonFinalizationListener has been stopped.") + tag, + "The manager was used after calls to the PigeonFinalizationListener has been stopped." + ) } } } + /** Generated API for managing the Dart and native `InstanceManager`s. */ private class AndroidWebkitLibraryPigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { companion object { /** The codec used by AndroidWebkitLibraryPigeonInstanceManagerApi. */ - val codec: MessageCodec by lazy { AndroidWebkitLibraryPigeonCodec() } + val codec: MessageCodec by lazy { + AndroidWebkitLibraryPigeonCodec() + } /** - * Sets up an instance of `AndroidWebkitLibraryPigeonInstanceManagerApi` to handle messages from - * the `binaryMessenger`. + * Sets up an instance of `AndroidWebkitLibraryPigeonInstanceManagerApi` to handle messages from the + * `binaryMessenger`. */ - fun setUpMessageHandlers( - binaryMessenger: BinaryMessenger, - instanceManager: AndroidWebkitLibraryPigeonInstanceManager? - ) { + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, instanceManager: AndroidWebkitLibraryPigeonInstanceManager?) { run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.removeStrongReference", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.removeStrongReference", codec) if (instanceManager != null) { channel.setMessageHandler { message, reply -> val args = message as List val identifierArg = args[0] as Long - val wrapped: List = - try { - instanceManager.remove(identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + instanceManager.remove(identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -300,20 +299,15 @@ private class AndroidWebkitLibraryPigeonInstanceManagerApi(val binaryMessenger: } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.clear", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.clear", codec) if (instanceManager != null) { channel.setMessageHandler { _, reply -> - val wrapped: List = - try { - instanceManager.clear() - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + instanceManager.clear() + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -323,28 +317,26 @@ private class AndroidWebkitLibraryPigeonInstanceManagerApi(val binaryMessenger: } } - fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) { - val channelName = - "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.removeStrongReference" + fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) +{ + val channelName = "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.removeStrongReference" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } /** - * Provides implementations for each ProxyApi implementation and provides access to resources needed - * by any implementation. + * Provides implementations for each ProxyApi implementation and provides access to resources + * needed by any implementation. */ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { /** Whether APIs should ignore calling to Dart. */ @@ -361,19 +353,20 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: init { val api = AndroidWebkitLibraryPigeonInstanceManagerApi(binaryMessenger) - instanceManager = - AndroidWebkitLibraryPigeonInstanceManager.create( - object : AndroidWebkitLibraryPigeonInstanceManager.PigeonFinalizationListener { - override fun onFinalize(identifier: Long) { - api.removeStrongReference(identifier) { - if (it.isFailure) { - Log.e( - "PigeonProxyApiRegistrar", - "Failed to remove Dart strong reference with identifier: $identifier") - } - } - } - }) + instanceManager = AndroidWebkitLibraryPigeonInstanceManager.create( + object : AndroidWebkitLibraryPigeonInstanceManager.PigeonFinalizationListener { + override fun onFinalize(identifier: Long) { + api.removeStrongReference(identifier) { + if (it.isFailure) { + Log.e( + "PigeonProxyApiRegistrar", + "Failed to remove Dart strong reference with identifier: $identifier" + ) + } + } + } + } + ) } /** * An implementation of [PigeonApiWebResourceRequest] used to add a new Dart instance of @@ -400,8 +393,8 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiWebResourceErrorCompat(): PigeonApiWebResourceErrorCompat /** - * An implementation of [PigeonApiWebViewPoint] used to add a new Dart instance of `WebViewPoint` - * to the Dart `InstanceManager`. + * An implementation of [PigeonApiWebViewPoint] used to add a new Dart instance of + * `WebViewPoint` to the Dart `InstanceManager`. */ abstract fun getPigeonApiWebViewPoint(): PigeonApiWebViewPoint @@ -418,14 +411,14 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiCookieManager(): PigeonApiCookieManager /** - * An implementation of [PigeonApiWebView] used to add a new Dart instance of `WebView` to the - * Dart `InstanceManager`. + * An implementation of [PigeonApiWebView] used to add a new Dart instance of + * `WebView` to the Dart `InstanceManager`. */ abstract fun getPigeonApiWebView(): PigeonApiWebView /** - * An implementation of [PigeonApiWebSettings] used to add a new Dart instance of `WebSettings` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiWebSettings] used to add a new Dart instance of + * `WebSettings` to the Dart `InstanceManager`. */ abstract fun getPigeonApiWebSettings(): PigeonApiWebSettings @@ -460,8 +453,8 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiFlutterAssetManager(): PigeonApiFlutterAssetManager /** - * An implementation of [PigeonApiWebStorage] used to add a new Dart instance of `WebStorage` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiWebStorage] used to add a new Dart instance of + * `WebStorage` to the Dart `InstanceManager`. */ abstract fun getPigeonApiWebStorage(): PigeonApiWebStorage @@ -484,14 +477,14 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiCustomViewCallback(): PigeonApiCustomViewCallback /** - * An implementation of [PigeonApiView] used to add a new Dart instance of `View` to the Dart - * `InstanceManager`. + * An implementation of [PigeonApiView] used to add a new Dart instance of + * `View` to the Dart `InstanceManager`. */ abstract fun getPigeonApiView(): PigeonApiView /** - * An implementation of [PigeonApiGeolocationPermissionsCallback] used to add a new Dart instance - * of `GeolocationPermissionsCallback` to the Dart `InstanceManager`. + * An implementation of [PigeonApiGeolocationPermissionsCallback] used to add a new Dart instance of + * `GeolocationPermissionsCallback` to the Dart `InstanceManager`. */ abstract fun getPigeonApiGeolocationPermissionsCallback(): PigeonApiGeolocationPermissionsCallback @@ -514,10 +507,11 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiClientCertRequest(): PigeonApiClientCertRequest /** - * An implementation of [PigeonApiPrivateKey] used to add a new Dart instance of `PrivateKey` to - * the Dart `InstanceManager`. + * An implementation of [PigeonApiPrivateKey] used to add a new Dart instance of + * `PrivateKey` to the Dart `InstanceManager`. */ - open fun getPigeonApiPrivateKey(): PigeonApiPrivateKey { + open fun getPigeonApiPrivateKey(): PigeonApiPrivateKey + { return PigeonApiPrivateKey(this) } @@ -525,7 +519,8 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: * An implementation of [PigeonApiX509Certificate] used to add a new Dart instance of * `X509Certificate` to the Dart `InstanceManager`. */ - open fun getPigeonApiX509Certificate(): PigeonApiX509Certificate { + open fun getPigeonApiX509Certificate(): PigeonApiX509Certificate + { return PigeonApiX509Certificate(this) } @@ -536,8 +531,8 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiSslErrorHandler(): PigeonApiSslErrorHandler /** - * An implementation of [PigeonApiSslError] used to add a new Dart instance of `SslError` to the - * Dart `InstanceManager`. + * An implementation of [PigeonApiSslError] used to add a new Dart instance of + * `SslError` to the Dart `InstanceManager`. */ abstract fun getPigeonApiSslError(): PigeonApiSslError @@ -553,38 +548,36 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: */ abstract fun getPigeonApiSslCertificate(): PigeonApiSslCertificate + /** + * An implementation of [PigeonApiCertificate] used to add a new Dart instance of + * `Certificate` to the Dart `InstanceManager`. + */ + abstract fun getPigeonApiCertificate(): PigeonApiCertificate + fun setUp() { - AndroidWebkitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger, instanceManager) + AndroidWebkitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager) PigeonApiCookieManager.setUpMessageHandlers(binaryMessenger, getPigeonApiCookieManager()) PigeonApiWebView.setUpMessageHandlers(binaryMessenger, getPigeonApiWebView()) PigeonApiWebSettings.setUpMessageHandlers(binaryMessenger, getPigeonApiWebSettings()) - PigeonApiJavaScriptChannel.setUpMessageHandlers( - binaryMessenger, getPigeonApiJavaScriptChannel()) + PigeonApiJavaScriptChannel.setUpMessageHandlers(binaryMessenger, getPigeonApiJavaScriptChannel()) PigeonApiWebViewClient.setUpMessageHandlers(binaryMessenger, getPigeonApiWebViewClient()) PigeonApiDownloadListener.setUpMessageHandlers(binaryMessenger, getPigeonApiDownloadListener()) PigeonApiWebChromeClient.setUpMessageHandlers(binaryMessenger, getPigeonApiWebChromeClient()) - PigeonApiFlutterAssetManager.setUpMessageHandlers( - binaryMessenger, getPigeonApiFlutterAssetManager()) + PigeonApiFlutterAssetManager.setUpMessageHandlers(binaryMessenger, getPigeonApiFlutterAssetManager()) PigeonApiWebStorage.setUpMessageHandlers(binaryMessenger, getPigeonApiWebStorage()) - PigeonApiPermissionRequest.setUpMessageHandlers( - binaryMessenger, getPigeonApiPermissionRequest()) - PigeonApiCustomViewCallback.setUpMessageHandlers( - binaryMessenger, getPigeonApiCustomViewCallback()) + PigeonApiPermissionRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiPermissionRequest()) + PigeonApiCustomViewCallback.setUpMessageHandlers(binaryMessenger, getPigeonApiCustomViewCallback()) PigeonApiView.setUpMessageHandlers(binaryMessenger, getPigeonApiView()) - PigeonApiGeolocationPermissionsCallback.setUpMessageHandlers( - binaryMessenger, getPigeonApiGeolocationPermissionsCallback()) + PigeonApiGeolocationPermissionsCallback.setUpMessageHandlers(binaryMessenger, getPigeonApiGeolocationPermissionsCallback()) PigeonApiHttpAuthHandler.setUpMessageHandlers(binaryMessenger, getPigeonApiHttpAuthHandler()) PigeonApiAndroidMessage.setUpMessageHandlers(binaryMessenger, getPigeonApiAndroidMessage()) - PigeonApiClientCertRequest.setUpMessageHandlers( - binaryMessenger, getPigeonApiClientCertRequest()) + PigeonApiClientCertRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiClientCertRequest()) PigeonApiSslErrorHandler.setUpMessageHandlers(binaryMessenger, getPigeonApiSslErrorHandler()) PigeonApiSslError.setUpMessageHandlers(binaryMessenger, getPigeonApiSslError()) - PigeonApiSslCertificateDName.setUpMessageHandlers( - binaryMessenger, getPigeonApiSslCertificateDName()) + PigeonApiSslCertificateDName.setUpMessageHandlers(binaryMessenger, getPigeonApiSslCertificateDName()) PigeonApiSslCertificate.setUpMessageHandlers(binaryMessenger, getPigeonApiSslCertificate()) + PigeonApiCertificate.setUpMessageHandlers(binaryMessenger, getPigeonApiCertificate()) } - fun tearDown() { AndroidWebkitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null) PigeonApiCookieManager.setUpMessageHandlers(binaryMessenger, null) @@ -607,19 +600,20 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: PigeonApiSslError.setUpMessageHandlers(binaryMessenger, null) PigeonApiSslCertificateDName.setUpMessageHandlers(binaryMessenger, null) PigeonApiSslCertificate.setUpMessageHandlers(binaryMessenger, null) + PigeonApiCertificate.setUpMessageHandlers(binaryMessenger, null) } } - -private class AndroidWebkitLibraryPigeonProxyApiBaseCodec( - val registrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) : AndroidWebkitLibraryPigeonCodec() { +private class AndroidWebkitLibraryPigeonProxyApiBaseCodec(val registrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) : AndroidWebkitLibraryPigeonCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 128.toByte() -> { val identifier: Long = readValue(buffer) as Long val instance: Any? = registrar.instanceManager.getInstance(identifier) if (instance == null) { - Log.e("PigeonProxyApiBaseCodec", "Failed to find instance with identifier: $identifier") + Log.e( + "PigeonProxyApiBaseCodec", + "Failed to find instance with identifier: $identifier" + ) } return instance } @@ -628,86 +622,100 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec( } override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - if (value is Boolean || - value is ByteArray || - value is Double || - value is DoubleArray || - value is FloatArray || - value is Int || - value is IntArray || - value is List<*> || - value is Long || - value is LongArray || - value is Map<*, *> || - value is String || - value is FileChooserMode || - value is ConsoleMessageLevel || - value is OverScrollMode || - value is SslErrorType || - value == null) { + if (value is Boolean || value is ByteArray || value is Double || value is DoubleArray || value is FloatArray || value is Int || value is IntArray || value is List<*> || value is Long || value is LongArray || value is Map<*, *> || value is String || value is FileChooserMode || value is ConsoleMessageLevel || value is OverScrollMode || value is SslErrorType || value == null) { super.writeValue(stream, value) return } if (value is android.webkit.WebResourceRequest) { - registrar.getPigeonApiWebResourceRequest().pigeon_newInstance(value) {} - } else if (value is android.webkit.WebResourceResponse) { - registrar.getPigeonApiWebResourceResponse().pigeon_newInstance(value) {} - } else if (android.os.Build.VERSION.SDK_INT >= 23 && value is android.webkit.WebResourceError) { - registrar.getPigeonApiWebResourceError().pigeon_newInstance(value) {} - } else if (value is androidx.webkit.WebResourceErrorCompat) { - registrar.getPigeonApiWebResourceErrorCompat().pigeon_newInstance(value) {} - } else if (value is WebViewPoint) { - registrar.getPigeonApiWebViewPoint().pigeon_newInstance(value) {} - } else if (value is android.webkit.ConsoleMessage) { - registrar.getPigeonApiConsoleMessage().pigeon_newInstance(value) {} - } else if (value is android.webkit.CookieManager) { - registrar.getPigeonApiCookieManager().pigeon_newInstance(value) {} - } else if (value is android.webkit.WebView) { - registrar.getPigeonApiWebView().pigeon_newInstance(value) {} - } else if (value is android.webkit.WebSettings) { - registrar.getPigeonApiWebSettings().pigeon_newInstance(value) {} - } else if (value is JavaScriptChannel) { - registrar.getPigeonApiJavaScriptChannel().pigeon_newInstance(value) {} - } else if (value is android.webkit.WebViewClient) { - registrar.getPigeonApiWebViewClient().pigeon_newInstance(value) {} - } else if (value is android.webkit.DownloadListener) { - registrar.getPigeonApiDownloadListener().pigeon_newInstance(value) {} - } else if (value - is io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl) { - registrar.getPigeonApiWebChromeClient().pigeon_newInstance(value) {} - } else if (value is io.flutter.plugins.webviewflutter.FlutterAssetManager) { - registrar.getPigeonApiFlutterAssetManager().pigeon_newInstance(value) {} - } else if (value is android.webkit.WebStorage) { - registrar.getPigeonApiWebStorage().pigeon_newInstance(value) {} - } else if (value is android.webkit.WebChromeClient.FileChooserParams) { - registrar.getPigeonApiFileChooserParams().pigeon_newInstance(value) {} - } else if (value is android.webkit.PermissionRequest) { - registrar.getPigeonApiPermissionRequest().pigeon_newInstance(value) {} - } else if (value is android.webkit.WebChromeClient.CustomViewCallback) { - registrar.getPigeonApiCustomViewCallback().pigeon_newInstance(value) {} - } else if (value is android.view.View) { - registrar.getPigeonApiView().pigeon_newInstance(value) {} - } else if (value is android.webkit.GeolocationPermissions.Callback) { - registrar.getPigeonApiGeolocationPermissionsCallback().pigeon_newInstance(value) {} - } else if (value is android.webkit.HttpAuthHandler) { - registrar.getPigeonApiHttpAuthHandler().pigeon_newInstance(value) {} - } else if (value is android.os.Message) { - registrar.getPigeonApiAndroidMessage().pigeon_newInstance(value) {} - } else if (value is android.webkit.ClientCertRequest) { - registrar.getPigeonApiClientCertRequest().pigeon_newInstance(value) {} - } else if (value is java.security.PrivateKey) { - registrar.getPigeonApiPrivateKey().pigeon_newInstance(value) {} - } else if (value is java.security.cert.X509Certificate) { - registrar.getPigeonApiX509Certificate().pigeon_newInstance(value) {} - } else if (value is android.webkit.SslErrorHandler) { - registrar.getPigeonApiSslErrorHandler().pigeon_newInstance(value) {} - } else if (value is android.net.http.SslError) { - registrar.getPigeonApiSslError().pigeon_newInstance(value) {} - } else if (value is android.net.http.SslCertificate.DName) { - registrar.getPigeonApiSslCertificateDName().pigeon_newInstance(value) {} - } else if (value is android.net.http.SslCertificate) { - registrar.getPigeonApiSslCertificate().pigeon_newInstance(value) {} + registrar.getPigeonApiWebResourceRequest().pigeon_newInstance(value) { } + } + else if (value is android.webkit.WebResourceResponse) { + registrar.getPigeonApiWebResourceResponse().pigeon_newInstance(value) { } + } + else if (android.os.Build.VERSION.SDK_INT >= 23 && value is android.webkit.WebResourceError) { + registrar.getPigeonApiWebResourceError().pigeon_newInstance(value) { } + } + else if (value is androidx.webkit.WebResourceErrorCompat) { + registrar.getPigeonApiWebResourceErrorCompat().pigeon_newInstance(value) { } + } + else if (value is WebViewPoint) { + registrar.getPigeonApiWebViewPoint().pigeon_newInstance(value) { } + } + else if (value is android.webkit.ConsoleMessage) { + registrar.getPigeonApiConsoleMessage().pigeon_newInstance(value) { } + } + else if (value is android.webkit.CookieManager) { + registrar.getPigeonApiCookieManager().pigeon_newInstance(value) { } + } + else if (value is android.webkit.WebView) { + registrar.getPigeonApiWebView().pigeon_newInstance(value) { } + } + else if (value is android.webkit.WebSettings) { + registrar.getPigeonApiWebSettings().pigeon_newInstance(value) { } + } + else if (value is JavaScriptChannel) { + registrar.getPigeonApiJavaScriptChannel().pigeon_newInstance(value) { } + } + else if (value is android.webkit.WebViewClient) { + registrar.getPigeonApiWebViewClient().pigeon_newInstance(value) { } + } + else if (value is android.webkit.DownloadListener) { + registrar.getPigeonApiDownloadListener().pigeon_newInstance(value) { } + } + else if (value is io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl) { + registrar.getPigeonApiWebChromeClient().pigeon_newInstance(value) { } + } + else if (value is io.flutter.plugins.webviewflutter.FlutterAssetManager) { + registrar.getPigeonApiFlutterAssetManager().pigeon_newInstance(value) { } + } + else if (value is android.webkit.WebStorage) { + registrar.getPigeonApiWebStorage().pigeon_newInstance(value) { } + } + else if (value is android.webkit.WebChromeClient.FileChooserParams) { + registrar.getPigeonApiFileChooserParams().pigeon_newInstance(value) { } + } + else if (value is android.webkit.PermissionRequest) { + registrar.getPigeonApiPermissionRequest().pigeon_newInstance(value) { } + } + else if (value is android.webkit.WebChromeClient.CustomViewCallback) { + registrar.getPigeonApiCustomViewCallback().pigeon_newInstance(value) { } + } + else if (value is android.view.View) { + registrar.getPigeonApiView().pigeon_newInstance(value) { } + } + else if (value is android.webkit.GeolocationPermissions.Callback) { + registrar.getPigeonApiGeolocationPermissionsCallback().pigeon_newInstance(value) { } + } + else if (value is android.webkit.HttpAuthHandler) { + registrar.getPigeonApiHttpAuthHandler().pigeon_newInstance(value) { } + } + else if (value is android.os.Message) { + registrar.getPigeonApiAndroidMessage().pigeon_newInstance(value) { } + } + else if (value is android.webkit.ClientCertRequest) { + registrar.getPigeonApiClientCertRequest().pigeon_newInstance(value) { } + } + else if (value is java.security.PrivateKey) { + registrar.getPigeonApiPrivateKey().pigeon_newInstance(value) { } + } + else if (value is java.security.cert.X509Certificate) { + registrar.getPigeonApiX509Certificate().pigeon_newInstance(value) { } + } + else if (value is android.webkit.SslErrorHandler) { + registrar.getPigeonApiSslErrorHandler().pigeon_newInstance(value) { } + } + else if (value is android.net.http.SslError) { + registrar.getPigeonApiSslError().pigeon_newInstance(value) { } + } + else if (value is android.net.http.SslCertificate.DName) { + registrar.getPigeonApiSslCertificateDName().pigeon_newInstance(value) { } + } + else if (value is android.net.http.SslCertificate) { + registrar.getPigeonApiSslCertificate().pigeon_newInstance(value) { } + } + else if (value is java.security.cert.Certificate) { + registrar.getPigeonApiCertificate().pigeon_newInstance(value) { } } when { @@ -715,9 +723,7 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec( stream.write(128) writeValue(stream, registrar.instanceManager.getIdentifierForStrongReference(value)) } - else -> - throw IllegalArgumentException( - "Unsupported value: '$value' of type '${value.javaClass.name}'") + else -> throw IllegalArgumentException("Unsupported value: '$value' of type '${value.javaClass.name}'") } } } @@ -729,31 +735,29 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec( */ enum class FileChooserMode(val raw: Int) { /** - * Open single file and requires that the file exists before allowing the user to pick it. + * Open single file and requires that the file exists before allowing the + * user to pick it. * - * See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. */ OPEN(0), /** * Similar to [open] but allows multiple files to be selected. * - * See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. */ OPEN_MULTIPLE(1), /** * Allows picking a nonexistent file and saving it. * - * See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. */ SAVE(2), /** * Indicates a `FileChooserMode` with an unknown mode. * - * This does not represent an actual value provided by the platform and only indicates a value was - * provided that isn't currently supported. + * This does not represent an actual value provided by the platform and only + * indicates a value was provided that isn't currently supported. */ UNKNOWN(3); @@ -803,8 +807,8 @@ enum class ConsoleMessageLevel(val raw: Int) { /** * Indicates a message with an unknown level. * - * This does not represent an actual value provided by the platform and only indicates a value was - * provided that isn't currently supported. + * This does not represent an actual value provided by the platform and only + * indicates a value was provided that isn't currently supported. */ UNKNOWN(5); @@ -821,11 +825,14 @@ enum class ConsoleMessageLevel(val raw: Int) { * See https://developer.android.com/reference/android/view/View#OVER_SCROLL_ALWAYS. */ enum class OverScrollMode(val raw: Int) { - /** Always allow a user to over-scroll this view, provided it is a view that can scroll. */ + /** + * Always allow a user to over-scroll this view, provided it is a view that + * can scroll. + */ ALWAYS(0), /** - * Allow a user to over-scroll this view only if the content is large enough to meaningfully - * scroll, provided it is a view that can scroll. + * Allow a user to over-scroll this view only if the content is large enough + * to meaningfully scroll, provided it is a view that can scroll. */ IF_CONTENT_SCROLLS(1), /** Never allow a user to over-scroll this view. */ @@ -867,27 +874,33 @@ enum class SslErrorType(val raw: Int) { } } } - private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as Long?)?.let { FileChooserMode.ofRaw(it.toInt()) } + return (readValue(buffer) as Long?)?.let { + FileChooserMode.ofRaw(it.toInt()) + } } 130.toByte() -> { - return (readValue(buffer) as Long?)?.let { ConsoleMessageLevel.ofRaw(it.toInt()) } + return (readValue(buffer) as Long?)?.let { + ConsoleMessageLevel.ofRaw(it.toInt()) + } } 131.toByte() -> { - return (readValue(buffer) as Long?)?.let { OverScrollMode.ofRaw(it.toInt()) } + return (readValue(buffer) as Long?)?.let { + OverScrollMode.ofRaw(it.toInt()) + } } 132.toByte() -> { - return (readValue(buffer) as Long?)?.let { SslErrorType.ofRaw(it.toInt()) } + return (readValue(buffer) as Long?)?.let { + SslErrorType.ofRaw(it.toInt()) + } } else -> super.readValueOfType(type, buffer) } } - - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { is FileChooserMode -> { stream.write(129) @@ -916,9 +929,7 @@ private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { * See https://developer.android.com/reference/android/webkit/WebResourceRequest. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebResourceRequest( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebResourceRequest(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** The URL for which the resource request was made. */ abstract fun url(pigeon_instance: android.webkit.WebResourceRequest): String @@ -935,25 +946,20 @@ abstract class PigeonApiWebResourceRequest( abstract fun method(pigeon_instance: android.webkit.WebResourceRequest): String /** The headers associated with the request. */ - abstract fun requestHeaders( - pigeon_instance: android.webkit.WebResourceRequest - ): Map? + abstract fun requestHeaders(pigeon_instance: android.webkit.WebResourceRequest): Map? @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebResourceRequest and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebResourceRequest, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebResourceRequest, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val urlArg = url(pigeon_instanceArg) val isForMainFrameArg = isForMainFrame(pigeon_instanceArg) val isRedirectArg = isRedirect(pigeon_instanceArg) @@ -962,32 +968,22 @@ abstract class PigeonApiWebResourceRequest( val requestHeadersArg = requestHeaders(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebResourceRequest.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebResourceRequest.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf( - pigeon_identifierArg, - urlArg, - isForMainFrameArg, - isRedirectArg, - hasGestureArg, - methodArg, - requestHeadersArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } + channel.send(listOf(pigeon_identifierArg, urlArg, isForMainFrameArg, isRedirectArg, hasGestureArg, methodArg, requestHeadersArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } } } + } /** * Encapsulates a resource response. @@ -995,58 +991,50 @@ abstract class PigeonApiWebResourceRequest( * See https://developer.android.com/reference/android/webkit/WebResourceResponse. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebResourceResponse( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebResourceResponse(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** The resource response's status code. */ abstract fun statusCode(pigeon_instance: android.webkit.WebResourceResponse): Long @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebResourceResponse and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebResourceResponse, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebResourceResponse, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val statusCodeArg = statusCode(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebResourceResponse.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebResourceResponse.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, statusCodeArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * Encapsulates information about errors that occurred during loading of web resources. + * Encapsulates information about errors that occurred during loading of web + * resources. * * See https://developer.android.com/reference/android/webkit/WebResourceError. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebResourceError( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebResourceError(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** The error code of the error. */ @androidx.annotation.RequiresApi(api = 23) abstract fun errorCode(pigeon_instance: android.webkit.WebResourceError): Long @@ -1058,51 +1046,45 @@ abstract class PigeonApiWebResourceError( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebResourceError and attaches it to [pigeon_instanceArg]. */ @androidx.annotation.RequiresApi(api = 23) - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebResourceError, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebResourceError, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorCodeArg = errorCode(pigeon_instanceArg) val descriptionArg = description(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebResourceError.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebResourceError.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, errorCodeArg, descriptionArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * Encapsulates information about errors that occurred during loading of web resources. + * Encapsulates information about errors that occurred during loading of web + * resources. * * See https://developer.android.com/reference/androidx/webkit/WebResourceErrorCompat. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebResourceErrorCompat( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebResourceErrorCompat(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** The error code of the error. */ abstract fun errorCode(pigeon_instance: androidx.webkit.WebResourceErrorCompat): Long @@ -1111,41 +1093,36 @@ abstract class PigeonApiWebResourceErrorCompat( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebResourceErrorCompat and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: androidx.webkit.WebResourceErrorCompat, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: androidx.webkit.WebResourceErrorCompat, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorCodeArg = errorCode(pigeon_instanceArg) val descriptionArg = description(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebResourceErrorCompat.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebResourceErrorCompat.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, errorCodeArg, descriptionArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * Represents a position on a web page. @@ -1153,25 +1130,23 @@ abstract class PigeonApiWebResourceErrorCompat( * This is a custom class created for convenience of the wrapper. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebViewPoint( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebViewPoint(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun x(pigeon_instance: WebViewPoint): Long abstract fun y(pigeon_instance: WebViewPoint): Long @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebViewPoint and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: WebViewPoint, callback: (Result) -> Unit) { + fun pigeon_newInstance(pigeon_instanceArg: WebViewPoint, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val xArg = x(pigeon_instanceArg) val yArg = y(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -1181,18 +1156,17 @@ abstract class PigeonApiWebViewPoint( channel.send(listOf(pigeon_identifierArg, xArg, yArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * Represents a JavaScript console message from WebCore. @@ -1200,9 +1174,7 @@ abstract class PigeonApiWebViewPoint( * See https://developer.android.com/reference/android/webkit/ConsoleMessage */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiConsoleMessage( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiConsoleMessage(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun lineNumber(pigeon_instance: android.webkit.ConsoleMessage): Long abstract fun message(pigeon_instance: android.webkit.ConsoleMessage): String @@ -1213,43 +1185,38 @@ abstract class PigeonApiConsoleMessage( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of ConsoleMessage and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.ConsoleMessage, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.ConsoleMessage, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val lineNumberArg = lineNumber(pigeon_instanceArg) val messageArg = message(pigeon_instanceArg) val levelArg = level(pigeon_instanceArg) val sourceIdArg = sourceId(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.ConsoleMessage.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.ConsoleMessage.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, lineNumberArg, messageArg, levelArg, sourceIdArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * Manages the cookies used by an application's `WebView` instances. @@ -1257,49 +1224,34 @@ abstract class PigeonApiConsoleMessage( * See https://developer.android.com/reference/android/webkit/CookieManager. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCookieManager( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiCookieManager(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun instance(): android.webkit.CookieManager /** Sets a single cookie (key-value pair) for the given URL. */ abstract fun setCookie(pigeon_instance: android.webkit.CookieManager, url: String, value: String) /** Removes all cookies. */ - abstract fun removeAllCookies( - pigeon_instance: android.webkit.CookieManager, - callback: (Result) -> Unit - ) + abstract fun removeAllCookies(pigeon_instance: android.webkit.CookieManager, callback: (Result) -> Unit) /** Sets whether the `WebView` should allow third party cookies to be set. */ - abstract fun setAcceptThirdPartyCookies( - pigeon_instance: android.webkit.CookieManager, - webView: android.webkit.WebView, - accept: Boolean - ) + abstract fun setAcceptThirdPartyCookies(pigeon_instance: android.webkit.CookieManager, webView: android.webkit.WebView, accept: Boolean) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCookieManager?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.CookieManager.instance", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CookieManager.instance", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1307,24 +1259,19 @@ abstract class PigeonApiCookieManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.CookieManager.setCookie", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CookieManager.setCookie", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.CookieManager val urlArg = args[1] as String val valueArg = args[2] as String - val wrapped: List = - try { - api.setCookie(pigeon_instanceArg, urlArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setCookie(pigeon_instanceArg, urlArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1332,11 +1279,7 @@ abstract class PigeonApiCookieManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.CookieManager.removeAllCookies", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CookieManager.removeAllCookies", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1344,10 +1287,10 @@ abstract class PigeonApiCookieManager( api.removeAllCookies(pigeon_instanceArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(AndroidWebkitLibraryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(AndroidWebkitLibraryPigeonUtils.wrapResult(data)) } } } @@ -1356,24 +1299,19 @@ abstract class PigeonApiCookieManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.CookieManager.setAcceptThirdPartyCookies", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CookieManager.setAcceptThirdPartyCookies", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.CookieManager val webViewArg = args[1] as android.webkit.WebView val acceptArg = args[2] as Boolean - val wrapped: List = - try { - api.setAcceptThirdPartyCookies(pigeon_instanceArg, webViewArg, acceptArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setAcceptThirdPartyCookies(pigeon_instanceArg, webViewArg, acceptArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1385,39 +1323,34 @@ abstract class PigeonApiCookieManager( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of CookieManager and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.CookieManager, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.CookieManager, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.CookieManager.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.CookieManager.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * A View that displays web pages. @@ -1425,38 +1358,23 @@ abstract class PigeonApiCookieManager( * See https://developer.android.com/reference/android/webkit/WebView. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebView( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun pigeon_defaultConstructor(): android.webkit.WebView /** The WebSettings object used to control the settings for this WebView. */ abstract fun settings(pigeon_instance: android.webkit.WebView): android.webkit.WebSettings /** Loads the given data into this WebView using a 'data' scheme URL. */ - abstract fun loadData( - pigeon_instance: android.webkit.WebView, - data: String, - mimeType: String?, - encoding: String? - ) - - /** Loads the given data into this WebView, using baseUrl as the base URL for the content. */ - abstract fun loadDataWithBaseUrl( - pigeon_instance: android.webkit.WebView, - baseUrl: String?, - data: String, - mimeType: String?, - encoding: String?, - historyUrl: String? - ) + abstract fun loadData(pigeon_instance: android.webkit.WebView, data: String, mimeType: String?, encoding: String?) + + /** + * Loads the given data into this WebView, using baseUrl as the base URL for + * the content. + */ + abstract fun loadDataWithBaseUrl(pigeon_instance: android.webkit.WebView, baseUrl: String?, data: String, mimeType: String?, encoding: String?, historyUrl: String?) /** Loads the given URL. */ - abstract fun loadUrl( - pigeon_instance: android.webkit.WebView, - url: String, - headers: Map - ) + abstract fun loadUrl(pigeon_instance: android.webkit.WebView, url: String, headers: Map) /** Loads the URL with postData using "POST" method into this WebView. */ abstract fun postUrl(pigeon_instance: android.webkit.WebView, url: String, data: ByteArray) @@ -1482,51 +1400,41 @@ abstract class PigeonApiWebView( /** Clears the resource cache. */ abstract fun clearCache(pigeon_instance: android.webkit.WebView, includeDiskFiles: Boolean) - /** Asynchronously evaluates JavaScript in the context of the currently displayed page. */ - abstract fun evaluateJavascript( - pigeon_instance: android.webkit.WebView, - javascriptString: String, - callback: (Result) -> Unit - ) + /** + * Asynchronously evaluates JavaScript in the context of the currently + * displayed page. + */ + abstract fun evaluateJavascript(pigeon_instance: android.webkit.WebView, javascriptString: String, callback: (Result) -> Unit) /** Gets the title for the current page. */ abstract fun getTitle(pigeon_instance: android.webkit.WebView): String? /** - * Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this - * application. + * Enables debugging of web contents (HTML / CSS / JavaScript) loaded into + * any WebViews of this application. */ abstract fun setWebContentsDebuggingEnabled(enabled: Boolean) - /** Sets the WebViewClient that will receive various notifications and requests. */ - abstract fun setWebViewClient( - pigeon_instance: android.webkit.WebView, - client: android.webkit.WebViewClient? - ) + /** + * Sets the WebViewClient that will receive various notifications and + * requests. + */ + abstract fun setWebViewClient(pigeon_instance: android.webkit.WebView, client: android.webkit.WebViewClient?) /** Injects the supplied Java object into this WebView. */ - abstract fun addJavaScriptChannel( - pigeon_instance: android.webkit.WebView, - channel: JavaScriptChannel - ) + abstract fun addJavaScriptChannel(pigeon_instance: android.webkit.WebView, channel: JavaScriptChannel) /** Removes a previously injected Java object from this WebView. */ abstract fun removeJavaScriptChannel(pigeon_instance: android.webkit.WebView, name: String) /** - * Registers the interface to be used when content can not be handled by the rendering engine, and - * should be downloaded instead. + * Registers the interface to be used when content can not be handled by the + * rendering engine, and should be downloaded instead. */ - abstract fun setDownloadListener( - pigeon_instance: android.webkit.WebView, - listener: android.webkit.DownloadListener? - ) + abstract fun setDownloadListener(pigeon_instance: android.webkit.WebView, listener: android.webkit.DownloadListener?) /** Sets the chrome handler. */ - abstract fun setWebChromeClient( - pigeon_instance: android.webkit.WebView, - client: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl? - ) + abstract fun setWebChromeClient(pigeon_instance: android.webkit.WebView, client: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl?) /** Sets the background color for this view. */ abstract fun setBackgroundColor(pigeon_instance: android.webkit.WebView, color: Long) @@ -1539,23 +1447,17 @@ abstract class PigeonApiWebView( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebView?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1563,24 +1465,18 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.settings", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.settings", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val pigeon_identifierArg = args[1] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.settings(pigeon_instanceArg), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.settings(pigeon_instanceArg), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1588,11 +1484,7 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.loadData", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.loadData", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1600,13 +1492,12 @@ abstract class PigeonApiWebView( val dataArg = args[1] as String val mimeTypeArg = args[2] as String? val encodingArg = args[3] as String? - val wrapped: List = - try { - api.loadData(pigeon_instanceArg, dataArg, mimeTypeArg, encodingArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.loadData(pigeon_instanceArg, dataArg, mimeTypeArg, encodingArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1614,11 +1505,7 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.loadDataWithBaseUrl", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.loadDataWithBaseUrl", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1628,19 +1515,12 @@ abstract class PigeonApiWebView( val mimeTypeArg = args[3] as String? val encodingArg = args[4] as String? val historyUrlArg = args[5] as String? - val wrapped: List = - try { - api.loadDataWithBaseUrl( - pigeon_instanceArg, - baseUrlArg, - dataArg, - mimeTypeArg, - encodingArg, - historyUrlArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.loadDataWithBaseUrl(pigeon_instanceArg, baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1648,24 +1528,19 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.loadUrl", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.loadUrl", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val urlArg = args[1] as String val headersArg = args[2] as Map - val wrapped: List = - try { - api.loadUrl(pigeon_instanceArg, urlArg, headersArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.loadUrl(pigeon_instanceArg, urlArg, headersArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1673,24 +1548,19 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.postUrl", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.postUrl", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val urlArg = args[1] as String val dataArg = args[2] as ByteArray - val wrapped: List = - try { - api.postUrl(pigeon_instanceArg, urlArg, dataArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.postUrl(pigeon_instanceArg, urlArg, dataArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1698,19 +1568,16 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.getUrl", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.getUrl", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = - try { - listOf(api.getUrl(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getUrl(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1718,21 +1585,16 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.canGoBack", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.canGoBack", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = - try { - listOf(api.canGoBack(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.canGoBack(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1740,21 +1602,16 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.canGoForward", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.canGoForward", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = - try { - listOf(api.canGoForward(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.canGoForward(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1762,20 +1619,17 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.goBack", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.goBack", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = - try { - api.goBack(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.goBack(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1783,22 +1637,17 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.goForward", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.goForward", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = - try { - api.goForward(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.goForward(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1806,20 +1655,17 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.reload", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.reload", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = - try { - api.reload(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.reload(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1827,23 +1673,18 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.clearCache", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.clearCache", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val includeDiskFilesArg = args[1] as Boolean - val wrapped: List = - try { - api.clearCache(pigeon_instanceArg, includeDiskFilesArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.clearCache(pigeon_instanceArg, includeDiskFilesArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1851,24 +1692,19 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.evaluateJavascript", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.evaluateJavascript", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val javascriptStringArg = args[1] as String - api.evaluateJavascript(pigeon_instanceArg, javascriptStringArg) { - result: Result -> + api.evaluateJavascript(pigeon_instanceArg, javascriptStringArg) { result: Result -> val error = result.exceptionOrNull() if (error != null) { - reply.reply(wrapError(error)) + reply.reply(AndroidWebkitLibraryPigeonUtils.wrapError(error)) } else { val data = result.getOrNull() - reply.reply(wrapResult(data)) + reply.reply(AndroidWebkitLibraryPigeonUtils.wrapResult(data)) } } } @@ -1877,21 +1713,16 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.getTitle", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.getTitle", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = - try { - listOf(api.getTitle(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getTitle(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1899,22 +1730,17 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.setWebContentsDebuggingEnabled", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setWebContentsDebuggingEnabled", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val enabledArg = args[0] as Boolean - val wrapped: List = - try { - api.setWebContentsDebuggingEnabled(enabledArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setWebContentsDebuggingEnabled(enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1922,23 +1748,18 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.setWebViewClient", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setWebViewClient", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val clientArg = args[1] as android.webkit.WebViewClient? - val wrapped: List = - try { - api.setWebViewClient(pigeon_instanceArg, clientArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setWebViewClient(pigeon_instanceArg, clientArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1946,23 +1767,18 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.addJavaScriptChannel", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.addJavaScriptChannel", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val channelArg = args[1] as JavaScriptChannel - val wrapped: List = - try { - api.addJavaScriptChannel(pigeon_instanceArg, channelArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.addJavaScriptChannel(pigeon_instanceArg, channelArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1970,23 +1786,18 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.removeJavaScriptChannel", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.removeJavaScriptChannel", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val nameArg = args[1] as String - val wrapped: List = - try { - api.removeJavaScriptChannel(pigeon_instanceArg, nameArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.removeJavaScriptChannel(pigeon_instanceArg, nameArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1994,23 +1805,18 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.setDownloadListener", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setDownloadListener", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val listenerArg = args[1] as android.webkit.DownloadListener? - val wrapped: List = - try { - api.setDownloadListener(pigeon_instanceArg, listenerArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setDownloadListener(pigeon_instanceArg, listenerArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2018,26 +1824,18 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.setWebChromeClient", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setWebChromeClient", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val clientArg = - args[1] - as - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl? - val wrapped: List = - try { - api.setWebChromeClient(pigeon_instanceArg, clientArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val clientArg = args[1] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl? + val wrapped: List = try { + api.setWebChromeClient(pigeon_instanceArg, clientArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2045,23 +1843,18 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.setBackgroundColor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setBackgroundColor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val colorArg = args[1] as Long - val wrapped: List = - try { - api.setBackgroundColor(pigeon_instanceArg, colorArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setBackgroundColor(pigeon_instanceArg, colorArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2069,22 +1862,17 @@ abstract class PigeonApiWebView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebView.destroy", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.destroy", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = - try { - api.destroy(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.destroy(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2096,19 +1884,16 @@ abstract class PigeonApiWebView( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebView and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebView, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebView, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.WebView.pigeon_newInstance" @@ -2116,31 +1901,23 @@ abstract class PigeonApiWebView( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } /** - * This is called in response to an internal scroll in this view (i.e., the view scrolled its own - * contents). + * This is called in response to an internal scroll in this view (i.e., the + * view scrolled its own contents). */ - fun onScrollChanged( - pigeon_instanceArg: android.webkit.WebView, - leftArg: Long, - topArg: Long, - oldLeftArg: Long, - oldTopArg: Long, - callback: (Result) -> Unit - ) { + fun onScrollChanged(pigeon_instanceArg: android.webkit.WebView, leftArg: Long, topArg: Long, oldLeftArg: Long, oldTopArg: Long, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2154,23 +1931,23 @@ abstract class PigeonApiWebView( channel.send(listOf(pigeon_instanceArg, leftArg, topArg, oldLeftArg, oldTopArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } @Suppress("FunctionName") /** An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView { + fun pigeon_getPigeonApiView(): PigeonApiView + { return pigeonRegistrar.getPigeonApiView() } + } /** * Manages settings state for a `WebView`. @@ -2178,68 +1955,52 @@ abstract class PigeonApiWebView( * See https://developer.android.com/reference/android/webkit/WebSettings. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebSettings( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** Sets whether the DOM storage API is enabled. */ abstract fun setDomStorageEnabled(pigeon_instance: android.webkit.WebSettings, flag: Boolean) /** Tells JavaScript to open windows automatically. */ - abstract fun setJavaScriptCanOpenWindowsAutomatically( - pigeon_instance: android.webkit.WebSettings, - flag: Boolean - ) + abstract fun setJavaScriptCanOpenWindowsAutomatically(pigeon_instance: android.webkit.WebSettings, flag: Boolean) /** Sets whether the WebView whether supports multiple windows. */ - abstract fun setSupportMultipleWindows( - pigeon_instance: android.webkit.WebSettings, - support: Boolean - ) + abstract fun setSupportMultipleWindows(pigeon_instance: android.webkit.WebSettings, support: Boolean) /** Tells the WebView to enable JavaScript execution. */ abstract fun setJavaScriptEnabled(pigeon_instance: android.webkit.WebSettings, flag: Boolean) /** Sets the WebView's user-agent string. */ - abstract fun setUserAgentString( - pigeon_instance: android.webkit.WebSettings, - userAgentString: String? - ) + abstract fun setUserAgentString(pigeon_instance: android.webkit.WebSettings, userAgentString: String?) /** Sets whether the WebView requires a user gesture to play media. */ - abstract fun setMediaPlaybackRequiresUserGesture( - pigeon_instance: android.webkit.WebSettings, - require: Boolean - ) + abstract fun setMediaPlaybackRequiresUserGesture(pigeon_instance: android.webkit.WebSettings, require: Boolean) /** - * Sets whether the WebView should support zooming using its on-screen zoom controls and gestures. + * Sets whether the WebView should support zooming using its on-screen zoom + * controls and gestures. */ abstract fun setSupportZoom(pigeon_instance: android.webkit.WebSettings, support: Boolean) /** - * Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on - * screen by width. + * Sets whether the WebView loads pages in overview mode, that is, zooms out + * the content to fit on screen by width. */ - abstract fun setLoadWithOverviewMode( - pigeon_instance: android.webkit.WebSettings, - overview: Boolean - ) + abstract fun setLoadWithOverviewMode(pigeon_instance: android.webkit.WebSettings, overview: Boolean) /** - * Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a - * wide viewport. + * Sets whether the WebView should enable support for the "viewport" HTML + * meta tag or should use a wide viewport. */ abstract fun setUseWideViewPort(pigeon_instance: android.webkit.WebSettings, use: Boolean) /** - * Sets whether the WebView should display on-screen zoom controls when using the built-in zoom - * mechanisms. + * Sets whether the WebView should display on-screen zoom controls when using + * the built-in zoom mechanisms. */ abstract fun setDisplayZoomControls(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) /** - * Sets whether the WebView should display on-screen zoom controls when using the built-in zoom - * mechanisms. + * Sets whether the WebView should display on-screen zoom controls when using + * the built-in zoom mechanisms. */ abstract fun setBuiltInZoomControls(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) @@ -2263,23 +2024,18 @@ abstract class PigeonApiWebSettings( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebSettings?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setDomStorageEnabled", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setDomStorageEnabled", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val flagArg = args[1] as Boolean - val wrapped: List = - try { - api.setDomStorageEnabled(pigeon_instanceArg, flagArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setDomStorageEnabled(pigeon_instanceArg, flagArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2287,23 +2043,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setJavaScriptCanOpenWindowsAutomatically", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setJavaScriptCanOpenWindowsAutomatically", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val flagArg = args[1] as Boolean - val wrapped: List = - try { - api.setJavaScriptCanOpenWindowsAutomatically(pigeon_instanceArg, flagArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setJavaScriptCanOpenWindowsAutomatically(pigeon_instanceArg, flagArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2311,23 +2062,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setSupportMultipleWindows", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setSupportMultipleWindows", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val supportArg = args[1] as Boolean - val wrapped: List = - try { - api.setSupportMultipleWindows(pigeon_instanceArg, supportArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setSupportMultipleWindows(pigeon_instanceArg, supportArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2335,23 +2081,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setJavaScriptEnabled", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setJavaScriptEnabled", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val flagArg = args[1] as Boolean - val wrapped: List = - try { - api.setJavaScriptEnabled(pigeon_instanceArg, flagArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setJavaScriptEnabled(pigeon_instanceArg, flagArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2359,23 +2100,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setUserAgentString", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setUserAgentString", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val userAgentStringArg = args[1] as String? - val wrapped: List = - try { - api.setUserAgentString(pigeon_instanceArg, userAgentStringArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setUserAgentString(pigeon_instanceArg, userAgentStringArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2383,23 +2119,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setMediaPlaybackRequiresUserGesture", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setMediaPlaybackRequiresUserGesture", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val requireArg = args[1] as Boolean - val wrapped: List = - try { - api.setMediaPlaybackRequiresUserGesture(pigeon_instanceArg, requireArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setMediaPlaybackRequiresUserGesture(pigeon_instanceArg, requireArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2407,23 +2138,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setSupportZoom", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setSupportZoom", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val supportArg = args[1] as Boolean - val wrapped: List = - try { - api.setSupportZoom(pigeon_instanceArg, supportArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setSupportZoom(pigeon_instanceArg, supportArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2431,23 +2157,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setLoadWithOverviewMode", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setLoadWithOverviewMode", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val overviewArg = args[1] as Boolean - val wrapped: List = - try { - api.setLoadWithOverviewMode(pigeon_instanceArg, overviewArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setLoadWithOverviewMode(pigeon_instanceArg, overviewArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2455,23 +2176,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setUseWideViewPort", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setUseWideViewPort", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val useArg = args[1] as Boolean - val wrapped: List = - try { - api.setUseWideViewPort(pigeon_instanceArg, useArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setUseWideViewPort(pigeon_instanceArg, useArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2479,23 +2195,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setDisplayZoomControls", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setDisplayZoomControls", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = - try { - api.setDisplayZoomControls(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setDisplayZoomControls(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2503,23 +2214,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setBuiltInZoomControls", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setBuiltInZoomControls", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = - try { - api.setBuiltInZoomControls(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setBuiltInZoomControls(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2527,23 +2233,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setAllowFileAccess", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setAllowFileAccess", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = - try { - api.setAllowFileAccess(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setAllowFileAccess(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2551,23 +2252,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setAllowContentAccess", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setAllowContentAccess", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = - try { - api.setAllowContentAccess(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setAllowContentAccess(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2575,23 +2271,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setGeolocationEnabled", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setGeolocationEnabled", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = - try { - api.setGeolocationEnabled(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setGeolocationEnabled(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2599,23 +2290,18 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.setTextZoom", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setTextZoom", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val textZoomArg = args[1] as Long - val wrapped: List = - try { - api.setTextZoom(pigeon_instanceArg, textZoomArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setTextZoom(pigeon_instanceArg, textZoomArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2623,21 +2309,16 @@ abstract class PigeonApiWebSettings( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebSettings.getUserAgentString", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.getUserAgentString", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings - val wrapped: List = - try { - listOf(api.getUserAgentString(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getUserAgentString(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2649,19 +2330,16 @@ abstract class PigeonApiWebSettings( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebSettings and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebSettings, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebSettings, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.WebSettings.pigeon_newInstance" @@ -2669,18 +2347,17 @@ abstract class PigeonApiWebSettings( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * A JavaScript interface for exposing Javascript callbacks to Dart. @@ -2689,9 +2366,7 @@ abstract class PigeonApiWebSettings( * [JavascriptInterface](https://developer.android.com/reference/android/webkit/JavascriptInterface). */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiJavaScriptChannel( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiJavaScriptChannel(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun pigeon_defaultConstructor(channelName: String): JavaScriptChannel companion object { @@ -2699,24 +2374,18 @@ abstract class PigeonApiJavaScriptChannel( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiJavaScriptChannel?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.JavaScriptChannel.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.JavaScriptChannel.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long val channelNameArg = args[1] as String - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(channelNameArg), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(channelNameArg), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2728,29 +2397,24 @@ abstract class PigeonApiJavaScriptChannel( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of JavaScriptChannel and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: JavaScriptChannel, callback: (Result) -> Unit) { + fun pigeon_newInstance(pigeon_instanceArg: JavaScriptChannel, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - AndroidWebKitError( - "new-instance-error", - "Attempting to create a new Dart instance of JavaScriptChannel, but the class has a nonnull callback method.", - ""))) + AndroidWebKitError("new-instance-error", "Attempting to create a new Dart instance of JavaScriptChannel, but the class has a nonnull callback method.", ""))) } } /** Handles callbacks messages from JavaScript. */ - fun postMessage( - pigeon_instanceArg: JavaScriptChannel, - messageArg: String, - callback: (Result) -> Unit - ) { + fun postMessage(pigeon_instanceArg: JavaScriptChannel, messageArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2764,17 +2428,16 @@ abstract class PigeonApiJavaScriptChannel( channel.send(listOf(pigeon_instanceArg, messageArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } + } /** * Receives various notifications and requests from a `WebView`. @@ -2782,51 +2445,41 @@ abstract class PigeonApiJavaScriptChannel( * See https://developer.android.com/reference/android/webkit/WebViewClient. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebViewClient( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun pigeon_defaultConstructor(): android.webkit.WebViewClient /** * Sets the required synchronous return value for the Java method, * `WebViewClient.shouldOverrideUrlLoading(...)`. * - * The Java method, `WebViewClient.shouldOverrideUrlLoading(...)`, requires a boolean to be - * returned and this method sets the returned value for all calls to the Java method. + * The Java method, `WebViewClient.shouldOverrideUrlLoading(...)`, requires + * a boolean to be returned and this method sets the returned value for all + * calls to the Java method. * - * Setting this to true causes the current [WebView] to abort loading any URL received by - * [requestLoading] or [urlLoading], while setting this to false causes the [WebView] to continue - * loading a URL as usual. + * Setting this to true causes the current [WebView] to abort loading any URL + * received by [requestLoading] or [urlLoading], while setting this to false + * causes the [WebView] to continue loading a URL as usual. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForShouldOverrideUrlLoading( - pigeon_instance: android.webkit.WebViewClient, - value: Boolean - ) + abstract fun setSynchronousReturnValueForShouldOverrideUrlLoading(pigeon_instance: android.webkit.WebViewClient, value: Boolean) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebViewClient?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebViewClient.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2834,24 +2487,18 @@ abstract class PigeonApiWebViewClient( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.setSynchronousReturnValueForShouldOverrideUrlLoading", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebViewClient.setSynchronousReturnValueForShouldOverrideUrlLoading", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebViewClient val valueArg = args[1] as Boolean - val wrapped: List = - try { - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setSynchronousReturnValueForShouldOverrideUrlLoading(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2863,47 +2510,37 @@ abstract class PigeonApiWebViewClient( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebViewClient and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebViewClient, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebViewClient, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } /** Notify the host application that a page has started loading. */ - fun onPageStarted( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - urlArg: String, - callback: (Result) -> Unit - ) { + fun onPageStarted(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2917,25 +2554,19 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Notify the host application that a page has finished loading. */ - fun onPageFinished( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - urlArg: String, - callback: (Result) -> Unit - ) { + fun onPageFinished(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2949,29 +2580,22 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that an HTTP error has been received from the server while loading - * a resource. + * Notify the host application that an HTTP error has been received from the + * server while loading a resource. */ - fun onReceivedHttpError( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - requestArg: android.webkit.WebResourceRequest, - responseArg: android.webkit.WebResourceResponse, - callback: (Result) -> Unit - ) { + fun onReceivedHttpError(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, requestArg: android.webkit.WebResourceRequest, responseArg: android.webkit.WebResourceResponse, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2985,27 +2609,20 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, webViewArg, requestArg, responseArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Report web resource loading error to the host application. */ @androidx.annotation.RequiresApi(api = 23) - fun onReceivedRequestError( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - requestArg: android.webkit.WebResourceRequest, - errorArg: android.webkit.WebResourceError, - callback: (Result) -> Unit - ) { + fun onReceivedRequestError(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, requestArg: android.webkit.WebResourceRequest, errorArg: android.webkit.WebResourceError, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3014,32 +2631,24 @@ abstract class PigeonApiWebViewClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedRequestError" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedRequestError" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, webViewArg, requestArg, errorArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Report web resource loading error to the host application. */ - fun onReceivedRequestErrorCompat( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - requestArg: android.webkit.WebResourceRequest, - errorArg: androidx.webkit.WebResourceErrorCompat, - callback: (Result) -> Unit - ) { + fun onReceivedRequestErrorCompat(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, requestArg: android.webkit.WebResourceRequest, errorArg: androidx.webkit.WebResourceErrorCompat, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3048,33 +2657,24 @@ abstract class PigeonApiWebViewClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedRequestErrorCompat" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedRequestErrorCompat" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, webViewArg, requestArg, errorArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Report an error to the host application. */ - fun onReceivedError( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - errorCodeArg: Long, - descriptionArg: String, - failingUrlArg: String, - callback: (Result) -> Unit - ) { + fun onReceivedError(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, errorCodeArg: Long, descriptionArg: String, failingUrlArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3085,32 +2685,25 @@ abstract class PigeonApiWebViewClient( val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedError" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf(pigeon_instanceArg, webViewArg, errorCodeArg, descriptionArg, failingUrlArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } + channel.send(listOf(pigeon_instanceArg, webViewArg, errorCodeArg, descriptionArg, failingUrlArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } } /** - * Give the host application a chance to take control when a URL is about to be loaded in the - * current WebView. + * Give the host application a chance to take control when a URL is about to + * be loaded in the current WebView. */ - fun requestLoading( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - requestArg: android.webkit.WebResourceRequest, - callback: (Result) -> Unit - ) { + fun requestLoading(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, requestArg: android.webkit.WebResourceRequest, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3124,28 +2717,22 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, webViewArg, requestArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Give the host application a chance to take control when a URL is about to be loaded in the - * current WebView. + * Give the host application a chance to take control when a URL is about to + * be loaded in the current WebView. */ - fun urlLoading( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - urlArg: String, - callback: (Result) -> Unit - ) { + fun urlLoading(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3159,26 +2746,19 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Notify the host application to update its visited links database. */ - fun doUpdateVisitedHistory( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - urlArg: String, - isReloadArg: Boolean, - callback: (Result) -> Unit - ) { + fun doUpdateVisitedHistory(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, urlArg: String, isReloadArg: Boolean, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3187,33 +2767,27 @@ abstract class PigeonApiWebViewClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.doUpdateVisitedHistory" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.doUpdateVisitedHistory" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, isReloadArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } - /** Notifies the host application that the WebView received an HTTP authentication request. */ - fun onReceivedHttpAuthRequest( - pigeon_instanceArg: android.webkit.WebViewClient, - webViewArg: android.webkit.WebView, - handlerArg: android.webkit.HttpAuthHandler, - hostArg: String, - realmArg: String, - callback: (Result) -> Unit - ) { + /** + * Notifies the host application that the WebView received an HTTP + * authentication request. + */ + fun onReceivedHttpAuthRequest(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, handlerArg: android.webkit.HttpAuthHandler, hostArg: String, realmArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3222,35 +2796,27 @@ abstract class PigeonApiWebViewClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedHttpAuthRequest" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedHttpAuthRequest" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, webViewArg, handlerArg, hostArg, realmArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Ask the host application if the browser should resend data as the requested page was a result - * of a POST. + * Ask the host application if the browser should resend data as the + * requested page was a result of a POST. */ - fun onFormResubmission( - pigeon_instanceArg: android.webkit.WebViewClient, - viewArg: android.webkit.WebView, - dontResendArg: android.os.Message, - resendArg: android.os.Message, - callback: (Result) -> Unit - ) { + fun onFormResubmission(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, dontResendArg: android.os.Message, resendArg: android.os.Message, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3264,27 +2830,22 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, viewArg, dontResendArg, resendArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that the WebView will load the resource specified by the given url. + * Notify the host application that the WebView will load the resource + * specified by the given url. */ - fun onLoadResource( - pigeon_instanceArg: android.webkit.WebViewClient, - viewArg: android.webkit.WebView, - urlArg: String, - callback: (Result) -> Unit - ) { + fun onLoadResource(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3298,28 +2859,22 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, viewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that WebView content left over from previous page navigations will - * no longer be drawn. + * Notify the host application that WebView content left over from previous + * page navigations will no longer be drawn. */ - fun onPageCommitVisible( - pigeon_instanceArg: android.webkit.WebViewClient, - viewArg: android.webkit.WebView, - urlArg: String, - callback: (Result) -> Unit - ) { + fun onPageCommitVisible(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3333,25 +2888,19 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, viewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Notify the host application to handle a SSL client certificate request. */ - fun onReceivedClientCertRequest( - pigeon_instanceArg: android.webkit.WebViewClient, - viewArg: android.webkit.WebView, - requestArg: android.webkit.ClientCertRequest, - callback: (Result) -> Unit - ) { + fun onReceivedClientCertRequest(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, requestArg: android.webkit.ClientCertRequest, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3360,35 +2909,27 @@ abstract class PigeonApiWebViewClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedClientCertRequest" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedClientCertRequest" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, viewArg, requestArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that a request to automatically log in the user has been processed. + * Notify the host application that a request to automatically log in the + * user has been processed. */ - fun onReceivedLoginRequest( - pigeon_instanceArg: android.webkit.WebViewClient, - viewArg: android.webkit.WebView, - realmArg: String, - accountArg: String?, - argsArg: String, - callback: (Result) -> Unit - ) { + fun onReceivedLoginRequest(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, realmArg: String, accountArg: String?, argsArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3397,32 +2938,27 @@ abstract class PigeonApiWebViewClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedLoginRequest" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedLoginRequest" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, viewArg, realmArg, accountArg, argsArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } - /** Notifies the host application that an SSL error occurred while loading a resource. */ - fun onReceivedSslError( - pigeon_instanceArg: android.webkit.WebViewClient, - viewArg: android.webkit.WebView, - handlerArg: android.webkit.SslErrorHandler, - errorArg: android.net.http.SslError, - callback: (Result) -> Unit - ) { + /** + * Notifies the host application that an SSL error occurred while loading a + * resource. + */ + fun onReceivedSslError(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, handlerArg: android.webkit.SslErrorHandler, errorArg: android.net.http.SslError, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3436,26 +2972,22 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, viewArg, handlerArg, errorArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } - /** Notify the host application that the scale applied to the WebView has changed. */ - fun onScaleChanged( - pigeon_instanceArg: android.webkit.WebViewClient, - viewArg: android.webkit.WebView, - oldScaleArg: Double, - newScaleArg: Double, - callback: (Result) -> Unit - ) { + /** + * Notify the host application that the scale applied to the WebView has + * changed. + */ + fun onScaleChanged(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, oldScaleArg: Double, newScaleArg: Double, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3469,17 +3001,16 @@ abstract class PigeonApiWebViewClient( channel.send(listOf(pigeon_instanceArg, viewArg, oldScaleArg, newScaleArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } + } /** * Handles notifications that a file should be downloaded. @@ -3487,9 +3018,7 @@ abstract class PigeonApiWebViewClient( * See https://developer.android.com/reference/android/webkit/DownloadListener. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiDownloadListener( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiDownloadListener(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun pigeon_defaultConstructor(): android.webkit.DownloadListener companion object { @@ -3497,23 +3026,17 @@ abstract class PigeonApiDownloadListener( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiDownloadListener?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.DownloadListener.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.DownloadListener.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3525,36 +3048,24 @@ abstract class PigeonApiDownloadListener( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of DownloadListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.DownloadListener, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.DownloadListener, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - AndroidWebKitError( - "new-instance-error", - "Attempting to create a new Dart instance of DownloadListener, but the class has a nonnull callback method.", - ""))) + AndroidWebKitError("new-instance-error", "Attempting to create a new Dart instance of DownloadListener, but the class has a nonnull callback method.", ""))) } } /** Notify the host application that a file should be downloaded. */ - fun onDownloadStart( - pigeon_instanceArg: android.webkit.DownloadListener, - urlArg: String, - userAgentArg: String, - contentDispositionArg: String, - mimetypeArg: String, - contentLengthArg: Long, - callback: (Result) -> Unit - ) { + fun onDownloadStart(pigeon_instanceArg: android.webkit.DownloadListener, urlArg: String, userAgentArg: String, contentDispositionArg: String, mimetypeArg: String, contentLengthArg: Long, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3565,160 +3076,133 @@ abstract class PigeonApiDownloadListener( val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.DownloadListener.onDownloadStart" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf( - pigeon_instanceArg, - urlArg, - userAgentArg, - contentDispositionArg, - mimetypeArg, - contentLengthArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } + channel.send(listOf(pigeon_instanceArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } } + } /** - * Handles notification of JavaScript dialogs, favicons, titles, and the progress. + * Handles notification of JavaScript dialogs, favicons, titles, and the + * progress. * * See https://developer.android.com/reference/android/webkit/WebChromeClient. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebChromeClient( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { - abstract fun pigeon_defaultConstructor(): - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl +abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { + abstract fun pigeon_defaultConstructor(): io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onShowFileChooser(...)`. * - * The Java method, `WebChromeClient.onShowFileChooser(...)`, requires a boolean to be returned - * and this method sets the returned value for all calls to the Java method. + * The Java method, `WebChromeClient.onShowFileChooser(...)`, requires + * a boolean to be returned and this method sets the returned value for all + * calls to the Java method. * - * Setting this to true indicates that all file chooser requests should be handled by - * `onShowFileChooser` and the returned list of Strings will be returned to the WebView. - * Otherwise, the client will use the default handling and the returned value in - * `onShowFileChooser` will be ignored. + * Setting this to true indicates that all file chooser requests should be + * handled by `onShowFileChooser` and the returned list of Strings will be + * returned to the WebView. Otherwise, the client will use the default + * handling and the returned value in `onShowFileChooser` will be ignored. * * Requires `onShowFileChooser` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnShowFileChooser( - pigeon_instance: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - value: Boolean - ) + abstract fun setSynchronousReturnValueForOnShowFileChooser(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onConsoleMessage(...)`. * - * The Java method, `WebChromeClient.onConsoleMessage(...)`, requires a boolean to be returned and - * this method sets the returned value for all calls to the Java method. + * The Java method, `WebChromeClient.onConsoleMessage(...)`, requires + * a boolean to be returned and this method sets the returned value for all + * calls to the Java method. * - * Setting this to true indicates that the client is handling all console messages. + * Setting this to true indicates that the client is handling all console + * messages. * * Requires `onConsoleMessage` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnConsoleMessage( - pigeon_instance: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - value: Boolean - ) + abstract fun setSynchronousReturnValueForOnConsoleMessage(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onJsAlert(...)`. * - * The Java method, `WebChromeClient.onJsAlert(...)`, requires a boolean to be returned and this - * method sets the returned value for all calls to the Java method. + * The Java method, `WebChromeClient.onJsAlert(...)`, requires a boolean to + * be returned and this method sets the returned value for all calls to the + * Java method. * - * Setting this to true indicates that the client is handling all console messages. + * Setting this to true indicates that the client is handling all console + * messages. * * Requires `onJsAlert` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnJsAlert( - pigeon_instance: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - value: Boolean - ) + abstract fun setSynchronousReturnValueForOnJsAlert(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onJsConfirm(...)`. * - * The Java method, `WebChromeClient.onJsConfirm(...)`, requires a boolean to be returned and this - * method sets the returned value for all calls to the Java method. + * The Java method, `WebChromeClient.onJsConfirm(...)`, requires a boolean to + * be returned and this method sets the returned value for all calls to the + * Java method. * - * Setting this to true indicates that the client is handling all console messages. + * Setting this to true indicates that the client is handling all console + * messages. * * Requires `onJsConfirm` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnJsConfirm( - pigeon_instance: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - value: Boolean - ) + abstract fun setSynchronousReturnValueForOnJsConfirm(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onJsPrompt(...)`. * - * The Java method, `WebChromeClient.onJsPrompt(...)`, requires a boolean to be returned and this - * method sets the returned value for all calls to the Java method. + * The Java method, `WebChromeClient.onJsPrompt(...)`, requires a boolean to + * be returned and this method sets the returned value for all calls to the + * Java method. * - * Setting this to true indicates that the client is handling all console messages. + * Setting this to true indicates that the client is handling all console + * messages. * * Requires `onJsPrompt` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnJsPrompt( - pigeon_instance: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - value: Boolean - ) + abstract fun setSynchronousReturnValueForOnJsPrompt(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebChromeClient?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.pigeon_defaultConstructor", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.pigeon_defaultConstructor", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3726,25 +3210,18 @@ abstract class PigeonApiWebChromeClient( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnShowFileChooser", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnShowFileChooser", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = - try { - api.setSynchronousReturnValueForOnShowFileChooser(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setSynchronousReturnValueForOnShowFileChooser(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3752,25 +3229,18 @@ abstract class PigeonApiWebChromeClient( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnConsoleMessage", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnConsoleMessage", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = - try { - api.setSynchronousReturnValueForOnConsoleMessage(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setSynchronousReturnValueForOnConsoleMessage(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3778,25 +3248,18 @@ abstract class PigeonApiWebChromeClient( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsAlert", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsAlert", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = - try { - api.setSynchronousReturnValueForOnJsAlert(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setSynchronousReturnValueForOnJsAlert(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3804,25 +3267,18 @@ abstract class PigeonApiWebChromeClient( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsConfirm", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsConfirm", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = - try { - api.setSynchronousReturnValueForOnJsConfirm(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setSynchronousReturnValueForOnJsConfirm(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3830,25 +3286,18 @@ abstract class PigeonApiWebChromeClient( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsPrompt", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsPrompt", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] - as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = - try { - api.setSynchronousReturnValueForOnJsPrompt(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setSynchronousReturnValueForOnJsPrompt(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3860,35 +3309,24 @@ abstract class PigeonApiWebChromeClient( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebChromeClient and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - AndroidWebKitError( - "new-instance-error", - "Attempting to create a new Dart instance of WebChromeClient, but the class has a nonnull callback method.", - ""))) + AndroidWebKitError("new-instance-error", "Attempting to create a new Dart instance of WebChromeClient, but the class has a nonnull callback method.", ""))) } } /** Tell the host application the current progress of loading a page. */ - fun onProgressChanged( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - webViewArg: android.webkit.WebView, - progressArg: Long, - callback: (Result) -> Unit - ) { + fun onProgressChanged(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, progressArg: Long, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3902,26 +3340,19 @@ abstract class PigeonApiWebChromeClient( channel.send(listOf(pigeon_instanceArg, webViewArg, progressArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Tell the client to show a file chooser. */ - fun onShowFileChooser( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - webViewArg: android.webkit.WebView, - paramsArg: android.webkit.WebChromeClient.FileChooserParams, - callback: (Result>) -> Unit - ) { + fun onShowFileChooser(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, paramsArg: android.webkit.WebChromeClient.FileChooserParams, callback: (Result>) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3935,36 +3366,26 @@ abstract class PigeonApiWebChromeClient( channel.send(listOf(pigeon_instanceArg, webViewArg, paramsArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else if (it[0] == null) { - callback( - Result.failure( - AndroidWebKitError( - "null-error", - "Flutter api returned null value for non-null return value.", - ""))) + callback(Result.failure(AndroidWebKitError("null-error", "Flutter api returned null value for non-null return value.", ""))) } else { val output = it[0] as List callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that web content is requesting permission to access the specified - * resources and the permission currently isn't granted or denied. + * Notify the host application that web content is requesting permission to + * access the specified resources and the permission currently isn't granted + * or denied. */ - fun onPermissionRequest( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - requestArg: android.webkit.PermissionRequest, - callback: (Result) -> Unit - ) { + fun onPermissionRequest(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, requestArg: android.webkit.PermissionRequest, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3973,32 +3394,24 @@ abstract class PigeonApiWebChromeClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onPermissionRequest" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onPermissionRequest" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, requestArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Callback to Dart function `WebChromeClient.onShowCustomView`. */ - fun onShowCustomView( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - viewArg: android.view.View, - callbackArg: android.webkit.WebChromeClient.CustomViewCallback, - callback: (Result) -> Unit - ) { + fun onShowCustomView(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, viewArg: android.view.View, callbackArg: android.webkit.WebChromeClient.CustomViewCallback, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4012,24 +3425,22 @@ abstract class PigeonApiWebChromeClient( channel.send(listOf(pigeon_instanceArg, viewArg, callbackArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } - /** Notify the host application that the current page has entered full screen mode. */ - fun onHideCustomView( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - callback: (Result) -> Unit - ) { + /** + * Notify the host application that the current page has entered full screen + * mode. + */ + fun onHideCustomView(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4043,29 +3454,23 @@ abstract class PigeonApiWebChromeClient( channel.send(listOf(pigeon_instanceArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that web content from the specified origin is attempting to use the - * Geolocation API, but no permission state is currently set for that origin. + * Notify the host application that web content from the specified origin is + * attempting to use the Geolocation API, but no permission state is + * currently set for that origin. */ - fun onGeolocationPermissionsShowPrompt( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - originArg: String, - callbackArg: android.webkit.GeolocationPermissions.Callback, - callback: (Result) -> Unit - ) { + fun onGeolocationPermissionsShowPrompt(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, originArg: String, callbackArg: android.webkit.GeolocationPermissions.Callback, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4074,33 +3479,28 @@ abstract class PigeonApiWebChromeClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onGeolocationPermissionsShowPrompt" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onGeolocationPermissionsShowPrompt" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, originArg, callbackArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that a request for Geolocation permissions, made with a previous - * call to `onGeolocationPermissionsShowPrompt` has been canceled. + * Notify the host application that a request for Geolocation permissions, + * made with a previous call to `onGeolocationPermissionsShowPrompt` has been + * canceled. */ - fun onGeolocationPermissionsHidePrompt( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - callback: (Result) -> Unit - ) { + fun onGeolocationPermissionsHidePrompt(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4109,31 +3509,24 @@ abstract class PigeonApiWebChromeClient( } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onGeolocationPermissionsHidePrompt" + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onGeolocationPermissionsHidePrompt" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** Report a JavaScript console message to the host application. */ - fun onConsoleMessage( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - messageArg: android.webkit.ConsoleMessage, - callback: (Result) -> Unit - ) { + fun onConsoleMessage(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, messageArg: android.webkit.ConsoleMessage, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4147,29 +3540,22 @@ abstract class PigeonApiWebChromeClient( channel.send(listOf(pigeon_instanceArg, messageArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that the web page wants to display a JavaScript `alert()` dialog. + * Notify the host application that the web page wants to display a + * JavaScript `alert()` dialog. */ - fun onJsAlert( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - webViewArg: android.webkit.WebView, - urlArg: String, - messageArg: String, - callback: (Result) -> Unit - ) { + fun onJsAlert(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, urlArg: String, messageArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4183,29 +3569,22 @@ abstract class PigeonApiWebChromeClient( channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, messageArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that the web page wants to display a JavaScript `confirm()` dialog. + * Notify the host application that the web page wants to display a + * JavaScript `confirm()` dialog. */ - fun onJsConfirm( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - webViewArg: android.webkit.WebView, - urlArg: String, - messageArg: String, - callback: (Result) -> Unit - ) { + fun onJsConfirm(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, urlArg: String, messageArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4219,38 +3598,25 @@ abstract class PigeonApiWebChromeClient( channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, messageArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else if (it[0] == null) { - callback( - Result.failure( - AndroidWebKitError( - "null-error", - "Flutter api returned null value for non-null return value.", - ""))) + callback(Result.failure(AndroidWebKitError("null-error", "Flutter api returned null value for non-null return value.", ""))) } else { val output = it[0] as Boolean callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } /** - * Notify the host application that the web page wants to display a JavaScript `prompt()` dialog. + * Notify the host application that the web page wants to display a + * JavaScript `prompt()` dialog. */ - fun onJsPrompt( - pigeon_instanceArg: - io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, - webViewArg: android.webkit.WebView, - urlArg: String, - messageArg: String, - defaultValueArg: String, - callback: (Result) -> Unit - ) { + fun onJsPrompt(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, urlArg: String, messageArg: String, defaultValueArg: String, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4264,18 +3630,17 @@ abstract class PigeonApiWebChromeClient( channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, messageArg, defaultValueArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { val output = it[0] as String? callback(Result.success(output)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } + } /** * Provides access to the assets registered as part of the App bundle. @@ -4283,9 +3648,7 @@ abstract class PigeonApiWebChromeClient( * Convenience class for accessing Flutter asset resources. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiFlutterAssetManager( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiFlutterAssetManager(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** The global instance of the `FlutterAssetManager`. */ abstract fun instance(): io.flutter.plugins.webviewflutter.FlutterAssetManager @@ -4294,46 +3657,35 @@ abstract class PigeonApiFlutterAssetManager( * * Throws an IOException in case I/O operations were interrupted. */ - abstract fun list( - pigeon_instance: io.flutter.plugins.webviewflutter.FlutterAssetManager, - path: String - ): List + abstract fun list(pigeon_instance: io.flutter.plugins.webviewflutter.FlutterAssetManager, path: String): List /** * Gets the relative file path to the Flutter asset with the given name, including the file's * extension, e.g., "myImage.jpg". * - * The returned file path is relative to the Android app's standard asset's directory. Therefore, - * the returned path is appropriate to pass to Android's AssetManager, but the path is not - * appropriate to load as an absolute path. + * The returned file path is relative to the Android app's standard asset's + * directory. Therefore, the returned path is appropriate to pass to + * Android's AssetManager, but the path is not appropriate to load as an + * absolute path. */ - abstract fun getAssetFilePathByName( - pigeon_instance: io.flutter.plugins.webviewflutter.FlutterAssetManager, - name: String - ): String + abstract fun getAssetFilePathByName(pigeon_instance: io.flutter.plugins.webviewflutter.FlutterAssetManager, name: String): String companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiFlutterAssetManager?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.instance", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.instance", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4341,23 +3693,17 @@ abstract class PigeonApiFlutterAssetManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.list", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.list", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] as io.flutter.plugins.webviewflutter.FlutterAssetManager + val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.FlutterAssetManager val pathArg = args[1] as String - val wrapped: List = - try { - listOf(api.list(pigeon_instanceArg, pathArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.list(pigeon_instanceArg, pathArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4365,23 +3711,17 @@ abstract class PigeonApiFlutterAssetManager( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.getAssetFilePathByName", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.getAssetFilePathByName", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = - args[0] as io.flutter.plugins.webviewflutter.FlutterAssetManager + val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.FlutterAssetManager val nameArg = args[1] as String - val wrapped: List = - try { - listOf(api.getAssetFilePathByName(pigeon_instanceArg, nameArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getAssetFilePathByName(pigeon_instanceArg, nameArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4393,49 +3733,43 @@ abstract class PigeonApiFlutterAssetManager( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of FlutterAssetManager and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: io.flutter.plugins.webviewflutter.FlutterAssetManager, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: io.flutter.plugins.webviewflutter.FlutterAssetManager, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * This class is used to manage the JavaScript storage APIs provided by the WebView. + * This class is used to manage the JavaScript storage APIs provided by the + * WebView. * * See https://developer.android.com/reference/android/webkit/WebStorage. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebStorage( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiWebStorage(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun instance(): android.webkit.WebStorage /** Clears all storage currently being used by the JavaScript storage APIs. */ @@ -4446,23 +3780,17 @@ abstract class PigeonApiWebStorage( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebStorage?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebStorage.instance", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebStorage.instance", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = - try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4470,22 +3798,17 @@ abstract class PigeonApiWebStorage( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.WebStorage.deleteAllData", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebStorage.deleteAllData", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebStorage - val wrapped: List = - try { - api.deleteAllData(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.deleteAllData(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4497,19 +3820,16 @@ abstract class PigeonApiWebStorage( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebStorage and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebStorage, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebStorage, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.WebStorage.pigeon_newInstance" @@ -4517,18 +3837,17 @@ abstract class PigeonApiWebStorage( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * Parameters used in the `WebChromeClient.onShowFileChooser` method. @@ -4536,88 +3855,68 @@ abstract class PigeonApiWebStorage( * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiFileChooserParams( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiFileChooserParams(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** Preference for a live media captured value (e.g. Camera, Microphone). */ - abstract fun isCaptureEnabled( - pigeon_instance: android.webkit.WebChromeClient.FileChooserParams - ): Boolean + abstract fun isCaptureEnabled(pigeon_instance: android.webkit.WebChromeClient.FileChooserParams): Boolean /** An array of acceptable MIME types. */ - abstract fun acceptTypes( - pigeon_instance: android.webkit.WebChromeClient.FileChooserParams - ): List + abstract fun acceptTypes(pigeon_instance: android.webkit.WebChromeClient.FileChooserParams): List /** File chooser mode. */ - abstract fun mode( - pigeon_instance: android.webkit.WebChromeClient.FileChooserParams - ): FileChooserMode + abstract fun mode(pigeon_instance: android.webkit.WebChromeClient.FileChooserParams): FileChooserMode /** File name of a default selection if specified, or null. */ - abstract fun filenameHint( - pigeon_instance: android.webkit.WebChromeClient.FileChooserParams - ): String? + abstract fun filenameHint(pigeon_instance: android.webkit.WebChromeClient.FileChooserParams): String? @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of FileChooserParams and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebChromeClient.FileChooserParams, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebChromeClient.FileChooserParams, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val isCaptureEnabledArg = isCaptureEnabled(pigeon_instanceArg) val acceptTypesArg = acceptTypes(pigeon_instanceArg) val modeArg = mode(pigeon_instanceArg) val filenameHintArg = filenameHint(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.FileChooserParams.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.FileChooserParams.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send( - listOf( - pigeon_identifierArg, - isCaptureEnabledArg, - acceptTypesArg, - modeArg, - filenameHintArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(createConnectionError(channelName))) - } + channel.send(listOf(pigeon_identifierArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } } } + } /** - * This class defines a permission request and is used when web content requests access to protected - * resources. + * This class defines a permission request and is used when web content + * requests access to protected resources. * * See https://developer.android.com/reference/android/webkit/PermissionRequest. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiPermissionRequest( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiPermissionRequest(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { abstract fun resources(pigeon_instance: android.webkit.PermissionRequest): List - /** Call this method to grant origin the permission to access the given resources. */ + /** + * Call this method to grant origin the permission to access the given + * resources. + */ abstract fun grant(pigeon_instance: android.webkit.PermissionRequest, resources: List) /** Call this method to deny the request. */ @@ -4628,23 +3927,18 @@ abstract class PigeonApiPermissionRequest( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiPermissionRequest?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.grant", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.grant", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.PermissionRequest val resourcesArg = args[1] as List - val wrapped: List = - try { - api.grant(pigeon_instanceArg, resourcesArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.grant(pigeon_instanceArg, resourcesArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4652,22 +3946,17 @@ abstract class PigeonApiPermissionRequest( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.deny", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.deny", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.PermissionRequest - val wrapped: List = - try { - api.deny(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.deny(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4679,77 +3968,63 @@ abstract class PigeonApiPermissionRequest( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of PermissionRequest and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.PermissionRequest, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.PermissionRequest, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val resourcesArg = resources(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, resourcesArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * A callback interface used by the host application to notify the current page that its custom view - * has been dismissed. + * A callback interface used by the host application to notify the current page + * that its custom view has been dismissed. * * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCustomViewCallback( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiCustomViewCallback(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** Invoked when the host application dismisses the custom view. */ - abstract fun onCustomViewHidden( - pigeon_instance: android.webkit.WebChromeClient.CustomViewCallback - ) + abstract fun onCustomViewHidden(pigeon_instance: android.webkit.WebChromeClient.CustomViewCallback) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCustomViewCallback?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.CustomViewCallback.onCustomViewHidden", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CustomViewCallback.onCustomViewHidden", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebChromeClient.CustomViewCallback - val wrapped: List = - try { - api.onCustomViewHidden(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.onCustomViewHidden(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4761,49 +4036,43 @@ abstract class PigeonApiCustomViewCallback( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of CustomViewCallback and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.WebChromeClient.CustomViewCallback, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebChromeClient.CustomViewCallback, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.CustomViewCallback.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.CustomViewCallback.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * This class represents the basic building block for user interface components. + * This class represents the basic building block for user interface + * components. * * See https://developer.android.com/reference/android/view/View. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiView( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** Set the scrolled position of your view. */ abstract fun scrollTo(pigeon_instance: android.view.View, x: Long, y: Long) @@ -4821,22 +4090,19 @@ abstract class PigeonApiView( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiView?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.scrollTo", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.scrollTo", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.View val xArg = args[1] as Long val yArg = args[2] as Long - val wrapped: List = - try { - api.scrollTo(pigeon_instanceArg, xArg, yArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.scrollTo(pigeon_instanceArg, xArg, yArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4844,22 +4110,19 @@ abstract class PigeonApiView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.scrollBy", codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.scrollBy", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.View val xArg = args[1] as Long val yArg = args[2] as Long - val wrapped: List = - try { - api.scrollBy(pigeon_instanceArg, xArg, yArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.scrollBy(pigeon_instanceArg, xArg, yArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4867,21 +4130,16 @@ abstract class PigeonApiView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.View.getScrollPosition", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.getScrollPosition", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.View - val wrapped: List = - try { - listOf(api.getScrollPosition(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getScrollPosition(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4889,23 +4147,18 @@ abstract class PigeonApiView( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.View.setOverScrollMode", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.setOverScrollMode", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.View val modeArg = args[1] as OverScrollMode - val wrapped: List = - try { - api.setOverScrollMode(pigeon_instanceArg, modeArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.setOverScrollMode(pigeon_instanceArg, modeArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4917,16 +4170,16 @@ abstract class PigeonApiView( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of View and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.view.View, callback: (Result) -> Unit) { + fun pigeon_newInstance(pigeon_instanceArg: android.view.View, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.View.pigeon_newInstance" @@ -4934,50 +4187,35 @@ abstract class PigeonApiView( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * A callback interface used by the host application to set the Geolocation permission state for an - * origin. + * A callback interface used by the host application to set the Geolocation + * permission state for an origin. * * See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiGeolocationPermissionsCallback( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiGeolocationPermissionsCallback(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** Sets the Geolocation permission state for the supplied origin. */ - abstract fun invoke( - pigeon_instance: android.webkit.GeolocationPermissions.Callback, - origin: String, - allow: Boolean, - retain: Boolean - ) + abstract fun invoke(pigeon_instance: android.webkit.GeolocationPermissions.Callback, origin: String, allow: Boolean, retain: Boolean) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers( - binaryMessenger: BinaryMessenger, - api: PigeonApiGeolocationPermissionsCallback? - ) { + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiGeolocationPermissionsCallback?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.GeolocationPermissionsCallback.invoke", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.GeolocationPermissionsCallback.invoke", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -4985,13 +4223,12 @@ abstract class PigeonApiGeolocationPermissionsCallback( val originArg = args[1] as String val allowArg = args[2] as Boolean val retainArg = args[3] as Boolean - val wrapped: List = - try { - api.invoke(pigeon_instanceArg, originArg, allowArg, retainArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.invoke(pigeon_instanceArg, originArg, allowArg, retainArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5002,43 +4239,35 @@ abstract class PigeonApiGeolocationPermissionsCallback( } @Suppress("LocalVariableName", "FunctionName") - /** - * Creates a Dart instance of GeolocationPermissionsCallback and attaches it to - * [pigeon_instanceArg]. - */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.GeolocationPermissions.Callback, - callback: (Result) -> Unit - ) { + /** Creates a Dart instance of GeolocationPermissionsCallback and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.GeolocationPermissions.Callback, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.GeolocationPermissionsCallback.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.GeolocationPermissionsCallback.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * Represents a request for HTTP authentication. @@ -5046,45 +4275,38 @@ abstract class PigeonApiGeolocationPermissionsCallback( * See https://developer.android.com/reference/android/webkit/HttpAuthHandler. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiHttpAuthHandler( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiHttpAuthHandler(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** - * Gets whether the credentials stored for the current host (i.e. the host for which - * `WebViewClient.onReceivedHttpAuthRequest` was called) are suitable for use. + * Gets whether the credentials stored for the current host (i.e. the host + * for which `WebViewClient.onReceivedHttpAuthRequest` was called) are + * suitable for use. */ abstract fun useHttpAuthUsernamePassword(pigeon_instance: android.webkit.HttpAuthHandler): Boolean /** Instructs the WebView to cancel the authentication request.. */ abstract fun cancel(pigeon_instance: android.webkit.HttpAuthHandler) - /** Instructs the WebView to proceed with the authentication with the given credentials. */ - abstract fun proceed( - pigeon_instance: android.webkit.HttpAuthHandler, - username: String, - password: String - ) + /** + * Instructs the WebView to proceed with the authentication with the given + * credentials. + */ + abstract fun proceed(pigeon_instance: android.webkit.HttpAuthHandler, username: String, password: String) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiHttpAuthHandler?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.useHttpAuthUsernamePassword", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.useHttpAuthUsernamePassword", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.HttpAuthHandler - val wrapped: List = - try { - listOf(api.useHttpAuthUsernamePassword(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.useHttpAuthUsernamePassword(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5092,22 +4314,17 @@ abstract class PigeonApiHttpAuthHandler( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.cancel", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.cancel", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.HttpAuthHandler - val wrapped: List = - try { - api.cancel(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.cancel(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5115,24 +4332,19 @@ abstract class PigeonApiHttpAuthHandler( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.proceed", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.proceed", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.HttpAuthHandler val usernameArg = args[1] as String val passwordArg = args[2] as String - val wrapped: List = - try { - api.proceed(pigeon_instanceArg, usernameArg, passwordArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.proceed(pigeon_instanceArg, usernameArg, passwordArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5144,52 +4356,46 @@ abstract class PigeonApiHttpAuthHandler( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of HttpAuthHandler and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.HttpAuthHandler, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.HttpAuthHandler, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * Defines a message containing a description and arbitrary data object that can be sent to a - * `Handler`. + * Defines a message containing a description and arbitrary data object that + * can be sent to a `Handler`. * * See https://developer.android.com/reference/android/os/Message. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAndroidMessage( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiAndroidMessage(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** - * Sends this message to the Android native `Handler` specified by getTarget(). + * Sends this message to the Android native `Handler` specified by + * getTarget(). * * Throws a null pointer exception if this field has not been set. */ @@ -5200,22 +4406,17 @@ abstract class PigeonApiAndroidMessage( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAndroidMessage?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.AndroidMessage.sendToTarget", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.AndroidMessage.sendToTarget", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.os.Message - val wrapped: List = - try { - api.sendToTarget(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.sendToTarget(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5227,47 +4428,43 @@ abstract class PigeonApiAndroidMessage( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of AndroidMessage and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.os.Message, callback: (Result) -> Unit) { + fun pigeon_newInstance(pigeon_instanceArg: android.os.Message, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.AndroidMessage.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.AndroidMessage.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * Defines a message containing a description and arbitrary data object that can be sent to a - * `Handler`. + * Defines a message containing a description and arbitrary data object that + * can be sent to a `Handler`. * * See https://developer.android.com/reference/android/webkit/ClientCertRequest. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiClientCertRequest( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiClientCertRequest(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** Cancel this request. */ abstract fun cancel(pigeon_instance: android.webkit.ClientCertRequest) @@ -5275,33 +4472,24 @@ abstract class PigeonApiClientCertRequest( abstract fun ignore(pigeon_instance: android.webkit.ClientCertRequest) /** Proceed with the specified private key and client certificate chain. */ - abstract fun proceed( - pigeon_instance: android.webkit.ClientCertRequest, - privateKey: java.security.PrivateKey, - chain: List - ) + abstract fun proceed(pigeon_instance: android.webkit.ClientCertRequest, privateKey: java.security.PrivateKey, chain: List) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiClientCertRequest?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.cancel", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.cancel", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.ClientCertRequest - val wrapped: List = - try { - api.cancel(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.cancel(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5309,22 +4497,17 @@ abstract class PigeonApiClientCertRequest( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.ignore", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.ignore", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.ClientCertRequest - val wrapped: List = - try { - api.ignore(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.ignore(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5332,24 +4515,19 @@ abstract class PigeonApiClientCertRequest( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.proceed", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.proceed", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.ClientCertRequest val privateKeyArg = args[1] as java.security.PrivateKey val chainArg = args[2] as List - val wrapped: List = - try { - api.proceed(pigeon_instanceArg, privateKeyArg, chainArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.proceed(pigeon_instanceArg, privateKeyArg, chainArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5361,67 +4539,57 @@ abstract class PigeonApiClientCertRequest( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of ClientCertRequest and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.ClientCertRequest, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.ClientCertRequest, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * A private key. * - * The purpose of this interface is to group (and provide type safety for) all private key - * interfaces. + * The purpose of this interface is to group (and provide type safety for) all + * private key interfaces. * * See https://developer.android.com/reference/java/security/PrivateKey. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiPrivateKey( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +open class PigeonApiPrivateKey(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of PrivateKey and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: java.security.PrivateKey, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: java.security.PrivateKey, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.PrivateKey.pigeon_newInstance" @@ -5429,65 +4597,65 @@ open class PigeonApiPrivateKey( channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * Abstract class for X.509 certificates. * - * This provides a standard way to access all the attributes of an X.509 certificate. + * This provides a standard way to access all the attributes of an X.509 + * certificate. * * See https://developer.android.com/reference/java/security/cert/X509Certificate. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiX509Certificate( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +open class PigeonApiX509Certificate(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of X509Certificate and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: java.security.cert.X509Certificate, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: java.security.cert.X509Certificate, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.X509Certificate.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.X509Certificate.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + + @Suppress("FunctionName") + /** An implementation of [PigeonApiCertificate] used to access callback methods */ + fun pigeon_getPigeonApiCertificate(): PigeonApiCertificate + { + return pigeonRegistrar.getPigeonApiCertificate() + } + } /** * Represents a request for handling an SSL error. @@ -5495,18 +4663,16 @@ open class PigeonApiX509Certificate( * See https://developer.android.com/reference/android/webkit/SslErrorHandler. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiSslErrorHandler( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiSslErrorHandler(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** - * Instructs the WebView that encountered the SSL certificate error to terminate communication - * with the server. + * Instructs the WebView that encountered the SSL certificate error to + * terminate communication with the server. */ abstract fun cancel(pigeon_instance: android.webkit.SslErrorHandler) /** - * Instructs the WebView that encountered the SSL certificate error to ignore the error and - * continue communicating with the server. + * Instructs the WebView that encountered the SSL certificate error to ignore + * the error and continue communicating with the server. */ abstract fun proceed(pigeon_instance: android.webkit.SslErrorHandler) @@ -5515,22 +4681,17 @@ abstract class PigeonApiSslErrorHandler( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiSslErrorHandler?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.cancel", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.cancel", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.SslErrorHandler - val wrapped: List = - try { - api.cancel(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.cancel(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5538,22 +4699,17 @@ abstract class PigeonApiSslErrorHandler( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.proceed", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.proceed", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.SslErrorHandler - val wrapped: List = - try { - api.proceed(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + api.proceed(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5565,53 +4721,45 @@ abstract class PigeonApiSslErrorHandler( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of SslErrorHandler and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.webkit.SslErrorHandler, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.webkit.SslErrorHandler, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** - * This class represents a set of one or more SSL errors and the associated SSL certificate. + * This class represents a set of one or more SSL errors and the associated SSL + * certificate. * * See https://developer.android.com/reference/android/net/http/SslError. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiSslError( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiSslError(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** Gets the SSL certificate associated with this object. */ - abstract fun certificate( - pigeon_instance: android.net.http.SslError - ): android.net.http.SslCertificate + abstract fun certificate(pigeon_instance: android.net.http.SslError): android.net.http.SslCertificate /** Gets the URL associated with this object. */ abstract fun url(pigeon_instance: android.net.http.SslError): String @@ -5627,21 +4775,16 @@ abstract class PigeonApiSslError( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiSslError?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslError.getPrimaryError", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslError.getPrimaryError", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslError - val wrapped: List = - try { - listOf(api.getPrimaryError(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getPrimaryError(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5649,22 +4792,17 @@ abstract class PigeonApiSslError( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslError.hasError", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslError.hasError", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslError val errorArg = args[1] as SslErrorType - val wrapped: List = - try { - listOf(api.hasError(pigeon_instanceArg, errorArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.hasError(pigeon_instanceArg, errorArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5676,19 +4814,16 @@ abstract class PigeonApiSslError( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of SslError and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.net.http.SslError, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.net.http.SslError, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val certificateArg = certificate(pigeon_instanceArg) val urlArg = url(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -5698,29 +4833,28 @@ abstract class PigeonApiSslError( channel.send(listOf(pigeon_identifierArg, certificateArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * A distinguished name helper class. * - * A 3-tuple of: the most specific common name (CN) the most specific organization (O) the most - * specific organizational unit (OU) + * A 3-tuple of: + * the most specific common name (CN) + * the most specific organization (O) + * the most specific organizational unit (OU) */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiSslCertificateDName( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiSslCertificateDName(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** The most specific Common-name (CN) component of this name. */ abstract fun getCName(pigeon_instance: android.net.http.SslCertificate.DName): String @@ -5738,21 +4872,16 @@ abstract class PigeonApiSslCertificateDName( fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiSslCertificateDName?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getCName", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getCName", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate.DName - val wrapped: List = - try { - listOf(api.getCName(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getCName(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5760,21 +4889,16 @@ abstract class PigeonApiSslCertificateDName( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getDName", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getDName", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate.DName - val wrapped: List = - try { - listOf(api.getDName(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getDName(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5782,21 +4906,16 @@ abstract class PigeonApiSslCertificateDName( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getOName", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getOName", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate.DName - val wrapped: List = - try { - listOf(api.getOName(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getOName(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5804,21 +4923,16 @@ abstract class PigeonApiSslCertificateDName( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getUName", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getUName", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate.DName - val wrapped: List = - try { - listOf(api.getUName(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getUName(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5830,39 +4944,34 @@ abstract class PigeonApiSslCertificateDName( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of SslCertificateDName and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.net.http.SslCertificate.DName, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.net.http.SslCertificate.DName, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) - } + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } + } /** * SSL certificate info (certificate details) class. @@ -5870,56 +4979,48 @@ abstract class PigeonApiSslCertificateDName( * See https://developer.android.com/reference/android/net/http/SslCertificate. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiSslCertificate( - open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar -) { +abstract class PigeonApiSslCertificate(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { /** Issued-by distinguished name or null if none has been set. */ - abstract fun getIssuedBy( - pigeon_instance: android.net.http.SslCertificate - ): android.net.http.SslCertificate.DName? + abstract fun getIssuedBy(pigeon_instance: android.net.http.SslCertificate): android.net.http.SslCertificate.DName? /** Issued-to distinguished name or null if none has been set. */ - abstract fun getIssuedTo( - pigeon_instance: android.net.http.SslCertificate - ): android.net.http.SslCertificate.DName? + abstract fun getIssuedTo(pigeon_instance: android.net.http.SslCertificate): android.net.http.SslCertificate.DName? - /** Not-after date from the certificate validity period or null if none has been set. */ + /** + * Not-after date from the certificate validity period or null if none has been + * set. + */ abstract fun getValidNotAfterMsSinceEpoch(pigeon_instance: android.net.http.SslCertificate): Long? - /** Not-before date from the certificate validity period or null if none has been set. */ - abstract fun getValidNotBeforeMsSinceEpoch( - pigeon_instance: android.net.http.SslCertificate - ): Long? + /** + * Not-before date from the certificate validity period or null if none has + * been set. + */ + abstract fun getValidNotBeforeMsSinceEpoch(pigeon_instance: android.net.http.SslCertificate): Long? /** - * The X509Certificate used to create this SslCertificate or null if no certificate was provided. + * The X509Certificate used to create this SslCertificate or null if no + * certificate was provided. * * Always returns null on Android versions below Q. */ - abstract fun getX509Certificate( - pigeon_instance: android.net.http.SslCertificate - ): java.security.cert.X509Certificate? + abstract fun getX509Certificate(pigeon_instance: android.net.http.SslCertificate): java.security.cert.X509Certificate? companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiSslCertificate?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getIssuedBy", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getIssuedBy", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = - try { - listOf(api.getIssuedBy(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getIssuedBy(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5927,21 +5028,16 @@ abstract class PigeonApiSslCertificate( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getIssuedTo", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getIssuedTo", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = - try { - listOf(api.getIssuedTo(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getIssuedTo(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5949,21 +5045,16 @@ abstract class PigeonApiSslCertificate( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getValidNotAfterMsSinceEpoch", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getValidNotAfterMsSinceEpoch", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = - try { - listOf(api.getValidNotAfterMsSinceEpoch(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getValidNotAfterMsSinceEpoch(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5971,21 +5062,16 @@ abstract class PigeonApiSslCertificate( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getValidNotBeforeMsSinceEpoch", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getValidNotBeforeMsSinceEpoch", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = - try { - listOf(api.getValidNotBeforeMsSinceEpoch(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getValidNotBeforeMsSinceEpoch(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5993,21 +5079,16 @@ abstract class PigeonApiSslCertificate( } } run { - val channel = - BasicMessageChannel( - binaryMessenger, - "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getX509Certificate", - codec) + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getX509Certificate", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = - try { - listOf(api.getX509Certificate(pigeon_instanceArg)) - } catch (exception: Throwable) { - wrapError(exception) - } + val wrapped: List = try { + listOf(api.getX509Certificate(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6019,37 +5100,97 @@ abstract class PigeonApiSslCertificate( @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of SslCertificate and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance( - pigeon_instanceArg: android.net.http.SslCertificate, - callback: (Result) -> Unit - ) { + fun pigeon_newInstance(pigeon_instanceArg: android.net.http.SslCertificate, callback: (Result) -> Unit) +{ if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = - pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = - "dev.flutter.pigeon.webview_flutter_android.SslCertificate.pigeon_newInstance" + val channelName = "dev.flutter.pigeon.webview_flutter_android.SslCertificate.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback( - Result.failure( - AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(createConnectionError(channelName))) + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } + } + } + +} +/** + * Abstract class for managing a variety of identity certificates. + * + * See https://developer.android.com/reference/java/security/cert/Certificate. + */ +@Suppress("UNCHECKED_CAST") +abstract class PigeonApiCertificate(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { + /** The encoded form of this certificate. */ + abstract fun getEncoded(pigeon_instance: java.security.cert.Certificate): ByteArray + + companion object { + @Suppress("LocalVariableName") + fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCertificate?) { + val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() + run { + val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.Certificate.getEncoded", codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val pigeon_instanceArg = args[0] as java.security.cert.Certificate + val wrapped: List = try { + listOf(api.getEncoded(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) } } } } + + @Suppress("LocalVariableName", "FunctionName") + /** Creates a Dart instance of Certificate and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance(pigeon_instanceArg: java.security.cert.Certificate, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + callback(Result.success(Unit)) + } else { + val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val binaryMessenger = pigeonRegistrar.binaryMessenger + val codec = pigeonRegistrar.codec + val channelName = "dev.flutter.pigeon.webview_flutter_android.Certificate.pigeon_newInstance" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pigeon_identifierArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } + } + } + } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart new file mode 100644 index 000000000000..a87e8800335c --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart @@ -0,0 +1,52 @@ +// 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 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; +import 'android_webkit.g.dart' as android; + +class AndroidSslCertificate extends SslCertificate { + AndroidSslCertificate._({super.data, super.errors}); + + static Future fromNativeSslError( + android.SslError error, + ) async { + final android.SslCertificate certificate = error.certificate; + final android.X509Certificate? x509Certificate = + await certificate.getX509Certificate(); + + final android.SslErrorType errorType = await error.getPrimaryError(); + final String errorDescription = switch (errorType) { + android.SslErrorType.dateInvalid => + 'The date of the certificate is invalid.', + android.SslErrorType.expired => 'The certificate has expired.', + android.SslErrorType.idMismatch => 'Hostname mismatch.', + android.SslErrorType.invalid => 'A generic error occurred.', + android.SslErrorType.notYetValid => 'The certificate is not yet valid.', + android.SslErrorType.untrusted => + 'The certificate authority is not trusted.', + android.SslErrorType.unknown => 'The certificate has an unknown error.', + }; + + return AndroidSslCertificate._( + data: x509Certificate != null ? await x509Certificate.getEncoded() : null, + errors: [SslError(description: errorDescription)], + ); + } +} + +class AndroidSslAuthRequest extends PlatformSslAuthRequest { + AndroidSslAuthRequest({ + required android.SslErrorHandler handler, + required super.certificates, + super.url, + }) : _handler = handler; + + final android.SslErrorHandler _handler; + + @override + Future cancel() => _handler.cancel(); + + @override + Future proceed() => _handler.proceed(); +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart index fe377e68926b..516fba97f802 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.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 (v25.3.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.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 @@ -194,6 +194,8 @@ class PigeonInstanceManager { pigeon_instanceManager: instanceManager); SslCertificate.pigeon_setUpMessageHandlers( pigeon_instanceManager: instanceManager); + Certificate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -7297,7 +7299,7 @@ class PrivateKey extends PigeonInternalProxyApiBaseClass { /// certificate. /// /// See https://developer.android.com/reference/java/security/cert/X509Certificate. -class X509Certificate extends PigeonInternalProxyApiBaseClass { +class X509Certificate extends Certificate { /// Constructs [X509Certificate] without creating the associated native object. /// /// This should only be used by subclasses created by this library or to @@ -7306,7 +7308,7 @@ class X509Certificate extends PigeonInternalProxyApiBaseClass { X509Certificate.pigeon_detached({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, - }); + }) : super.pigeon_detached(); static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, @@ -8118,3 +8120,113 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { ); } } + +/// Abstract class for managing a variety of identity certificates. +/// +/// See https://developer.android.com/reference/java/security/cert/Certificate. +class Certificate extends PigeonInternalProxyApiBaseClass { + /// Constructs [Certificate] 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 + Certificate.pigeon_detached({ + super.pigeon_binaryMessenger, + super.pigeon_instanceManager, + }); + + late final _PigeonInternalProxyApiBaseCodec _pigeonVar_codecCertificate = + _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); + + static void pigeon_setUpMessageHandlers({ + bool pigeon_clearHandlers = false, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + Certificate 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_android.Certificate.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_android.Certificate.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_android.Certificate.pigeon_newInstance was null, expected non-null int.'); + try { + (pigeon_instanceManager ?? PigeonInstanceManager.instance) + .addHostCreatedInstance( + pigeon_newInstance?.call() ?? + Certificate.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())); + } + }); + } + } + } + + /// The encoded form of this certificate. + Future getEncoded() async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecCertificate; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_android.Certificate.getEncoded'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture 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 Uint8List?)!; + } + } + + @override + Certificate pigeon_copy() { + return Certificate.pigeon_detached( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index c8326529e591..f165d10c16a2 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -12,6 +12,7 @@ import 'package:flutter/services.dart'; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'android_proxy.dart'; +import 'android_ssl_auth_request.dart'; import 'android_webkit.g.dart' as android_webview; import 'android_webkit_constants.dart'; import 'platform_views_service_proxy.dart'; @@ -1483,9 +1484,23 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { _, __, android_webview.SslErrorHandler handler, - ___, - ) { - handler.cancel(); + android_webview.SslError error, + ) async { + final void Function(PlatformSslAuthRequest)? callback = + weakThis.target?._onSslAuthRequest; + + if (callback != null) { + final AndroidSslAuthRequest authRequest = AndroidSslAuthRequest( + handler: handler, + certificates: [ + await AndroidSslCertificate.fromNativeSslError(error), + ], + ); + + callback(authRequest); + } else { + await handler.cancel(); + } }, ); @@ -1549,6 +1564,7 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { LoadRequestCallback? _onLoadRequest; UrlChangeCallback? _onUrlChange; HttpAuthRequestCallback? _onHttpAuthRequest; + SslAuthRequestCallback? _onSslAuthRequest; void _handleNavigation( String url, { @@ -1653,4 +1669,10 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { ) async { _onHttpAuthRequest = onHttpAuthRequest; } + + @override + Future setOnSSlAuthRequest( + SslAuthRequestCallback onSslAuthRequest) async { + _onSslAuthRequest = onSslAuthRequest; + } } diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart index 42a15fc68bde..30bee0f9f76a 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart @@ -951,7 +951,7 @@ abstract class PrivateKey {} fullClassName: 'java.security.cert.X509Certificate', ), ) -abstract class X509Certificate {} +abstract class X509Certificate extends Certificate {} /// Represents a request for handling an SSL error. /// @@ -1048,3 +1048,16 @@ abstract class SslCertificate { /// Always returns null on Android versions below Q. X509Certificate? getX509Certificate(); } + +/// Abstract class for managing a variety of identity certificates. +/// +/// See https://developer.android.com/reference/java/security/cert/Certificate. +@ProxyApi( + kotlinOptions: KotlinProxyApiOptions( + fullClassName: 'java.security.cert.Certificate', + ), +) +abstract class Certificate { + /// The encoded form of this certificate. + Uint8List getEncoded(); +} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/webview_flutter_platform_interface.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/webview_flutter_platform_interface.dart index d14fec163327..afd4f1aee047 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/webview_flutter_platform_interface.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/webview_flutter_platform_interface.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. export 'src/platform_navigation_delegate.dart'; +export 'src/platform_ssl_auth_request.dart'; export 'src/platform_webview_controller.dart'; export 'src/platform_webview_cookie_manager.dart'; export 'src/platform_webview_widget.dart'; From f3a112228d577b270edd4779f69f1e770fe5d6fa Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 23 Apr 2025 02:28:36 -0400 Subject: [PATCH 04/34] fix test names --- ...tCertRequestProxyApiTest.java => ClientCertRequestTest.java} | 2 +- ...icateDNameProxyApiTest.java => SslCertificateDNameTest.java} | 2 +- ...{SslCertificateProxyApiTest.java => SslCertificateTest.java} | 2 +- ...slErrorHandlerProxyApiTest.java => SslErrorHandlerTest.java} | 2 +- .../{SslErrorProxyApiTest.java => SslErrorTest.java} | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/{ClientCertRequestProxyApiTest.java => ClientCertRequestTest.java} (97%) rename packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/{SslCertificateDNameProxyApiTest.java => SslCertificateDNameTest.java} (97%) rename packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/{SslCertificateProxyApiTest.java => SslCertificateTest.java} (98%) rename packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/{SslErrorHandlerProxyApiTest.java => SslErrorHandlerTest.java} (95%) rename packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/{SslErrorProxyApiTest.java => SslErrorTest.java} (98%) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ClientCertRequestProxyApiTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ClientCertRequestTest.java similarity index 97% rename from packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ClientCertRequestProxyApiTest.java rename to packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ClientCertRequestTest.java index 37a816539fd7..8050d3779dc6 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ClientCertRequestProxyApiTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ClientCertRequestTest.java @@ -14,7 +14,7 @@ import java.util.List; import org.junit.Test; -public class ClientCertRequestProxyApiTest { +public class ClientCertRequestTest { @Test public void cancel() { final PigeonApiClientCertRequest api = diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateDNameProxyApiTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateDNameTest.java similarity index 97% rename from packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateDNameProxyApiTest.java rename to packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateDNameTest.java index 51477e7765ee..e4a9c5511608 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateDNameProxyApiTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateDNameTest.java @@ -11,7 +11,7 @@ import android.net.http.SslCertificate; import org.junit.Test; -public class SslCertificateDNameProxyApiTest { +public class SslCertificateDNameTest { @Test public void getCName() { final PigeonApiSslCertificateDName api = diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateProxyApiTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateTest.java similarity index 98% rename from packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateProxyApiTest.java rename to packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateTest.java index 0b9f8999a2d4..00b574f7a41d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateProxyApiTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslCertificateTest.java @@ -13,7 +13,7 @@ import java.util.Date; import org.junit.Test; -public class SslCertificateProxyApiTest { +public class SslCertificateTest { @Test public void getIssuedBy() { final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorHandlerProxyApiTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorHandlerTest.java similarity index 95% rename from packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorHandlerProxyApiTest.java rename to packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorHandlerTest.java index f308a9682eca..9149cbd9cb46 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorHandlerProxyApiTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorHandlerTest.java @@ -10,7 +10,7 @@ import android.webkit.SslErrorHandler; import org.junit.Test; -public class SslErrorHandlerProxyApiTest { +public class SslErrorHandlerTest { @Test public void cancel() { final PigeonApiSslErrorHandler api = new TestProxyApiRegistrar().getPigeonApiSslErrorHandler(); diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorProxyApiTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorTest.java similarity index 98% rename from packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorProxyApiTest.java rename to packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorTest.java index 6ce875461320..9c5d00176e40 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorProxyApiTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/SslErrorTest.java @@ -12,7 +12,7 @@ import android.net.http.SslError; import org.junit.Test; -public class SslErrorProxyApiTest { +public class SslErrorTest { @Test public void certificate() { final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); From 887104a1fe88163d285341667add660d2c8f4f5c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:20:01 -0400 Subject: [PATCH 05/34] new pigeon generate --- .../webviewflutter/AndroidWebkitLibrary.g.kt | 4105 ++++++++++++++++- .../webviewflutter/ProxyApiRegistrar.java | 6 + .../example/android/build.gradle | 3 +- .../lib/src/android_webkit.g.dart | 454 +- .../webview_flutter_android/pubspec.yaml | 6 +- 5 files changed, 4317 insertions(+), 257 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt index ca03e7bee038..4746c0dd994b 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt @@ -985,6 +985,159 @@ abstract class PigeonApiWebResourceRequest(open val pigeonRegistrar: AndroidWebk } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebResourceRequest; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebResourceRequest}. + * 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 WebResourceRequestProxyApi extends PigeonApiWebResourceRequest { + WebResourceRequestProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public String url(WebResourceRequest pigeon_instance) { + return pigeon_instance.getUrl(); + } + + @NonNull + @Override + public Boolean isForMainFrame(WebResourceRequest pigeon_instance) { + return pigeon_instance.getIsForMainFrame(); + } + + @Nullable + @Override + public Boolean? isRedirect(WebResourceRequest pigeon_instance) { + return pigeon_instance.getIsRedirect(); + } + + @NonNull + @Override + public Boolean hasGesture(WebResourceRequest pigeon_instance) { + return pigeon_instance.getHasGesture(); + } + + @NonNull + @Override + public String method(WebResourceRequest pigeon_instance) { + return pigeon_instance.getMethod(); + } + + @Nullable + @Override + public Map? requestHeaders(WebResourceRequest pigeon_instance) { + return pigeon_instance.getRequestHeaders(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebResourceRequest; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebResourceRequestTest { + @Test + public void url() { + final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); + + final WebResourceRequest instance = mock(WebResourceRequest.class); + final String value = "myString"; + when(instance.getUrl()).thenReturn(value); + + assertEquals(value, api.url(instance)); + } + + @Test + public void isForMainFrame() { + final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); + + final WebResourceRequest instance = mock(WebResourceRequest.class); + final Boolean value = true; + when(instance.getIsForMainFrame()).thenReturn(value); + + assertEquals(value, api.isForMainFrame(instance)); + } + + @Test + public void isRedirect() { + final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); + + final WebResourceRequest instance = mock(WebResourceRequest.class); + final Boolean value = true; + when(instance.getIsRedirect()).thenReturn(value); + + assertEquals(value, api.isRedirect(instance)); + } + + @Test + public void hasGesture() { + final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); + + final WebResourceRequest instance = mock(WebResourceRequest.class); + final Boolean value = true; + when(instance.getHasGesture()).thenReturn(value); + + assertEquals(value, api.hasGesture(instance)); + } + + @Test + public void method() { + final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); + + final WebResourceRequest instance = mock(WebResourceRequest.class); + final String value = "myString"; + when(instance.getMethod()).thenReturn(value); + + assertEquals(value, api.method(instance)); + } + + @Test + public void requestHeaders() { + final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); + + final WebResourceRequest instance = mock(WebResourceRequest.class); + final Map value = new HashMap() {{put("myString", "myString")}}; + when(instance.getRequestHeaders()).thenReturn(value); + + assertEquals(value, api.requestHeaders(instance)); + } + +} +*/ /** * Encapsulates a resource response. * @@ -1027,6 +1180,74 @@ abstract class PigeonApiWebResourceResponse(open val pigeonRegistrar: AndroidWeb } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebResourceResponse; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebResourceResponse}. + * 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 WebResourceResponseProxyApi extends PigeonApiWebResourceResponse { + WebResourceResponseProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public Long statusCode(WebResourceResponse pigeon_instance) { + return pigeon_instance.getStatusCode(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebResourceResponse; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebResourceResponseTest { + @Test + public void statusCode() { + final PigeonApiWebResourceResponse api = new TestProxyApiRegistrar().getPigeonApiWebResourceResponse(); + + final WebResourceResponse instance = mock(WebResourceResponse.class); + final Long value = 0; + when(instance.getStatusCode()).thenReturn(value); + + assertEquals(value, api.statusCode(instance)); + } + +} +*/ /** * Encapsulates information about errors that occurred during loading of web * resources. @@ -1077,6 +1298,91 @@ abstract class PigeonApiWebResourceError(open val pigeonRegistrar: AndroidWebkit } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebResourceError; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebResourceError}. + * 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 WebResourceErrorProxyApi extends PigeonApiWebResourceError { + WebResourceErrorProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public Long errorCode(WebResourceError pigeon_instance) { + return pigeon_instance.getErrorCode(); + } + + @NonNull + @Override + public String description(WebResourceError pigeon_instance) { + return pigeon_instance.getDescription(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebResourceError; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebResourceErrorTest { + @Test + public void errorCode() { + final PigeonApiWebResourceError api = new TestProxyApiRegistrar().getPigeonApiWebResourceError(); + + final WebResourceError instance = mock(WebResourceError.class); + final Long value = 0; + when(instance.getErrorCode()).thenReturn(value); + + assertEquals(value, api.errorCode(instance)); + } + + @Test + public void description() { + final PigeonApiWebResourceError api = new TestProxyApiRegistrar().getPigeonApiWebResourceError(); + + final WebResourceError instance = mock(WebResourceError.class); + final String value = "myString"; + when(instance.getDescription()).thenReturn(value); + + assertEquals(value, api.description(instance)); + } + +} +*/ /** * Encapsulates information about errors that occurred during loading of web * resources. @@ -1124,6 +1430,91 @@ abstract class PigeonApiWebResourceErrorCompat(open val pigeonRegistrar: Android } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import androidx.webkit.WebResourceErrorCompat; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebResourceErrorCompat}. + * 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 WebResourceErrorCompatProxyApi extends PigeonApiWebResourceErrorCompat { + WebResourceErrorCompatProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public Long errorCode(WebResourceErrorCompat pigeon_instance) { + return pigeon_instance.getErrorCode(); + } + + @NonNull + @Override + public String description(WebResourceErrorCompat pigeon_instance) { + return pigeon_instance.getDescription(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import androidx.webkit.WebResourceErrorCompat; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebResourceErrorCompatTest { + @Test + public void errorCode() { + final PigeonApiWebResourceErrorCompat api = new TestProxyApiRegistrar().getPigeonApiWebResourceErrorCompat(); + + final WebResourceErrorCompat instance = mock(WebResourceErrorCompat.class); + final Long value = 0; + when(instance.getErrorCode()).thenReturn(value); + + assertEquals(value, api.errorCode(instance)); + } + + @Test + public void description() { + final PigeonApiWebResourceErrorCompat api = new TestProxyApiRegistrar().getPigeonApiWebResourceErrorCompat(); + + final WebResourceErrorCompat instance = mock(WebResourceErrorCompat.class); + final String value = "myString"; + when(instance.getDescription()).thenReturn(value); + + assertEquals(value, api.description(instance)); + } + +} +*/ /** * Represents a position on a web page. * @@ -1168,6 +1559,91 @@ abstract class PigeonApiWebViewPoint(open val pigeonRegistrar: AndroidWebkitLibr } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebViewPoint}. + * 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 WebViewPointProxyApi extends PigeonApiWebViewPoint { + WebViewPointProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public Long x(WebViewPoint pigeon_instance) { + return pigeon_instance.getX(); + } + + @NonNull + @Override + public Long y(WebViewPoint pigeon_instance) { + return pigeon_instance.getY(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebViewPointTest { + @Test + public void x() { + final PigeonApiWebViewPoint api = new TestProxyApiRegistrar().getPigeonApiWebViewPoint(); + + final WebViewPoint instance = mock(WebViewPoint.class); + final Long value = 0; + when(instance.getX()).thenReturn(value); + + assertEquals(value, api.x(instance)); + } + + @Test + public void y() { + final PigeonApiWebViewPoint api = new TestProxyApiRegistrar().getPigeonApiWebViewPoint(); + + final WebViewPoint instance = mock(WebViewPoint.class); + final Long value = 0; + when(instance.getY()).thenReturn(value); + + assertEquals(value, api.y(instance)); + } + +} +*/ /** * Represents a JavaScript console message from WebCore. * @@ -1218,6 +1694,132 @@ abstract class PigeonApiConsoleMessage(open val pigeonRegistrar: AndroidWebkitLi } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.ConsoleMessage; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link ConsoleMessage}. + * 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 ConsoleMessageProxyApi extends PigeonApiConsoleMessage { + ConsoleMessageProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public Long lineNumber(ConsoleMessage pigeon_instance) { + return pigeon_instance.getLineNumber(); + } + + @NonNull + @Override + public String message(ConsoleMessage pigeon_instance) { + return pigeon_instance.getMessage(); + } + + @NonNull + @Override + public ConsoleMessageLevel level(ConsoleMessage pigeon_instance) { + switch (pigeon_instance.level) { + case ConsoleMessageLevel.DEBUG: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.DEBUG; + case ConsoleMessageLevel.ERROR: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.ERROR; + case ConsoleMessageLevel.LOG: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.LOG; + case ConsoleMessageLevel.TIP: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.TIP; + case ConsoleMessageLevel.WARNING: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.WARNING; + default: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.UNKNOWN; + } + } + + @NonNull + @Override + public String sourceId(ConsoleMessage pigeon_instance) { + return pigeon_instance.getSourceId(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.ConsoleMessage; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class ConsoleMessageTest { + @Test + public void lineNumber() { + final PigeonApiConsoleMessage api = new TestProxyApiRegistrar().getPigeonApiConsoleMessage(); + + final ConsoleMessage instance = mock(ConsoleMessage.class); + final Long value = 0; + when(instance.getLineNumber()).thenReturn(value); + + assertEquals(value, api.lineNumber(instance)); + } + + @Test + public void message() { + final PigeonApiConsoleMessage api = new TestProxyApiRegistrar().getPigeonApiConsoleMessage(); + + final ConsoleMessage instance = mock(ConsoleMessage.class); + final String value = "myString"; + when(instance.getMessage()).thenReturn(value); + + assertEquals(value, api.message(instance)); + } + + @Test + public void level() { + final PigeonApiConsoleMessage api = new TestProxyApiRegistrar().getPigeonApiConsoleMessage(); + + final ConsoleMessage instance = mock(ConsoleMessage.class); + final ConsoleMessageLevel value = io.flutter.plugins.webviewflutter.ConsoleMessageLevel.DEBUG; + when(instance.getLevel()).thenReturn(value); + + assertEquals(value, api.level(instance)); + } + + @Test + public void sourceId() { + final PigeonApiConsoleMessage api = new TestProxyApiRegistrar().getPigeonApiConsoleMessage(); + + final ConsoleMessage instance = mock(ConsoleMessage.class); + final String value = "myString"; + when(instance.getSourceId()).thenReturn(value); + + assertEquals(value, api.sourceId(instance)); + } + +} +*/ /** * Manages the cookies used by an application's `WebView` instances. * @@ -1352,6 +1954,116 @@ abstract class PigeonApiCookieManager(open val pigeonRegistrar: AndroidWebkitLib } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.CookieManager; +import android.webkit.WebView; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link CookieManager}. + * 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 CookieManagerProxyApi extends PigeonApiCookieManager { + CookieManagerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public android.webkit.CookieManager instance() { + return CookieManager.getInstance(); + } + + @Override + public void setCookie(@NonNull CookieManager pigeon_instance,@NonNull String url, @NonNull String value) { + pigeon_instance.setCookie(url, value); + } + + @NonNull + @Override + public Boolean removeAllCookies(@NonNull CookieManager pigeon_instance) { + return pigeon_instance.removeAllCookies(); + } + + @Override + public void setAcceptThirdPartyCookies(@NonNull CookieManager pigeon_instance,@NonNull android.webkit.WebView webView, @NonNull Boolean accept) { + pigeon_instance.setAcceptThirdPartyCookies(webView, accept); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.CookieManager; +import android.webkit.WebView; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class CookieManagerTest { + @Test + public void setCookie() { + final PigeonApiCookieManager api = new TestProxyApiRegistrar().getPigeonApiCookieManager(); + + final CookieManager instance = mock(CookieManager.class); + final String url = "myString"; + final String value = "myString"; + api.setCookie(instance, url, value); + + verify(instance).setCookie(url, value); + } + + @Test + public void removeAllCookies() { + final PigeonApiCookieManager api = new TestProxyApiRegistrar().getPigeonApiCookieManager(); + + final CookieManager instance = mock(CookieManager.class); + final Boolean value = true; + when(instance.removeAllCookies()).thenReturn(value); + + assertEquals(value, api.removeAllCookies(instance )); + } + + @Test + public void setAcceptThirdPartyCookies() { + final PigeonApiCookieManager api = new TestProxyApiRegistrar().getPigeonApiCookieManager(); + + final CookieManager instance = mock(CookieManager.class); + final android.webkit.WebView webView = mock(WebView.class); + final Boolean accept = true; + api.setAcceptThirdPartyCookies(instance, webView, accept); + + verify(instance).setAcceptThirdPartyCookies(webView, accept); + } + +} +*/ /** * A View that displays web pages. * @@ -1949,20 +2661,470 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } -/** - * Manages settings state for a `WebView`. - * - * See https://developer.android.com/reference/android/webkit/WebSettings. - */ -@Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { - /** Sets whether the DOM storage API is enabled. */ - abstract fun setDomStorageEnabled(pigeon_instance: android.webkit.WebSettings, flag: Boolean) - /** Tells JavaScript to open windows automatically. */ - abstract fun setJavaScriptCanOpenWindowsAutomatically(pigeon_instance: android.webkit.WebSettings, flag: Boolean) +/* +// 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. - /** Sets whether the WebView whether supports multiple windows. */ +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebView; +import android.webkit.WebSettings; +import android.webkit.WebViewClient; +import android.webkit.DownloadListener; +import io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebView}. + * 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 WebViewProxyApi extends PigeonApiWebView { + WebViewProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + /** Implementation of {@link WebView} that passes arguments of callback methods to Dart. */ + static class WebViewImpl extends WebView { + private final WebViewProxyApi api; + WebViewImpl(@NonNull WebViewProxyApi api) { + this.api = api; + } + @Override + public void onScrollChanged(@NonNull Long left, @NonNull Long top, @NonNull Long oldLeft, @NonNull Long oldTop) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onScrollChanged(this, left, top, oldLeft, oldTop, reply -> null)); + } + } + + @NonNull + @Override + public WebView pigeon_defaultConstructor() { + return WebViewImpl(); + } + + @NonNull + @Override + public android.webkit.WebSettings settings(WebView pigeon_instance) { + return pigeon_instance.getSettings(); + } + + @Override + public void loadData(@NonNull WebView pigeon_instance,@NonNull String data, @Nullable String? mimeType, @Nullable String? encoding) { + pigeon_instance.loadData(data, mimeType, encoding); + } + + @Override + public void loadDataWithBaseUrl(@NonNull WebView pigeon_instance,@Nullable String? baseUrl, @NonNull String data, @Nullable String? mimeType, @Nullable String? encoding, @Nullable String? historyUrl) { + pigeon_instance.loadDataWithBaseUrl(baseUrl, data, mimeType, encoding, historyUrl); + } + + @Override + public void loadUrl(@NonNull WebView pigeon_instance,@NonNull String url, @NonNull Map headers) { + pigeon_instance.loadUrl(url, headers); + } + + @Override + public void postUrl(@NonNull WebView pigeon_instance,@NonNull String url, @NonNull ByteArray data) { + pigeon_instance.postUrl(url, data); + } + + @Nullable + @Override + public String getUrl(@NonNull WebView pigeon_instance) { + return pigeon_instance.getUrl(); + } + + @NonNull + @Override + public Boolean canGoBack(@NonNull WebView pigeon_instance) { + return pigeon_instance.canGoBack(); + } + + @NonNull + @Override + public Boolean canGoForward(@NonNull WebView pigeon_instance) { + return pigeon_instance.canGoForward(); + } + + @Override + public void goBack(@NonNull WebView pigeon_instance) { + pigeon_instance.goBack(); + } + + @Override + public void goForward(@NonNull WebView pigeon_instance) { + pigeon_instance.goForward(); + } + + @Override + public void reload(@NonNull WebView pigeon_instance) { + pigeon_instance.reload(); + } + + @Override + public void clearCache(@NonNull WebView pigeon_instance,@NonNull Boolean includeDiskFiles) { + pigeon_instance.clearCache(includeDiskFiles); + } + + @Nullable + @Override + public String evaluateJavascript(@NonNull WebView pigeon_instance,@NonNull String javascriptString) { + return pigeon_instance.evaluateJavascript(javascriptString); + } + + @Nullable + @Override + public String getTitle(@NonNull WebView pigeon_instance) { + return pigeon_instance.getTitle(); + } + + @Override + public void setWebContentsDebuggingEnabled(@NonNull Boolean enabled) { + WebView.setWebContentsDebuggingEnabled(enabled); + } + + @Override + public void setWebViewClient(@NonNull WebView pigeon_instance,@Nullable android.webkit.WebViewClient? client) { + pigeon_instance.setWebViewClient(client); + } + + @Override + public void addJavaScriptChannel(@NonNull WebView pigeon_instance,@NonNull JavaScriptChannel channel) { + pigeon_instance.addJavaScriptChannel(channel); + } + + @Override + public void removeJavaScriptChannel(@NonNull WebView pigeon_instance,@NonNull String name) { + pigeon_instance.removeJavaScriptChannel(name); + } + + @Override + public void setDownloadListener(@NonNull WebView pigeon_instance,@Nullable android.webkit.DownloadListener? listener) { + pigeon_instance.setDownloadListener(listener); + } + + @Override + public void setWebChromeClient(@NonNull WebView pigeon_instance,@Nullable io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl? client) { + pigeon_instance.setWebChromeClient(client); + } + + @Override + public void setBackgroundColor(@NonNull WebView pigeon_instance,@NonNull Long color) { + pigeon_instance.setBackgroundColor(color); + } + + @Override + public void destroy(@NonNull WebView pigeon_instance) { + pigeon_instance.destroy(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebView; +import android.webkit.WebSettings; +import android.webkit.WebViewClient; +import android.webkit.DownloadListener; +import io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebViewTest { + @Test + public void pigeon_defaultConstructor() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + assertTrue(api.pigeon_defaultConstructor() instanceof WebViewProxyApi.WebView); + } + + @Test + public void settings() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final android.webkit.WebSettings value = mock(WebSettings.class); + when(instance.getSettings()).thenReturn(value); + + assertEquals(value, api.settings(instance)); + } + + @Test + public void loadData() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final String data = "myString"; + final String mimeType = "myString"; + final String encoding = "myString"; + api.loadData(instance, data, mimeType, encoding); + + verify(instance).loadData(data, mimeType, encoding); + } + + @Test + public void loadDataWithBaseUrl() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final String baseUrl = "myString"; + final String data = "myString"; + final String mimeType = "myString"; + final String encoding = "myString"; + final String historyUrl = "myString"; + api.loadDataWithBaseUrl(instance, baseUrl, data, mimeType, encoding, historyUrl); + + verify(instance).loadDataWithBaseUrl(baseUrl, data, mimeType, encoding, historyUrl); + } + + @Test + public void loadUrl() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final String url = "myString"; + final Map headers = new HashMap() {{put("myString", "myString")}}; + api.loadUrl(instance, url, headers); + + verify(instance).loadUrl(url, headers); + } + + @Test + public void postUrl() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final String url = "myString"; + final ByteArray data = {0xA1}; + api.postUrl(instance, url, data); + + verify(instance).postUrl(url, data); + } + + @Test + public void getUrl() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final String value = "myString"; + when(instance.getUrl()).thenReturn(value); + + assertEquals(value, api.getUrl(instance )); + } + + @Test + public void canGoBack() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final Boolean value = true; + when(instance.canGoBack()).thenReturn(value); + + assertEquals(value, api.canGoBack(instance )); + } + + @Test + public void canGoForward() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final Boolean value = true; + when(instance.canGoForward()).thenReturn(value); + + assertEquals(value, api.canGoForward(instance )); + } + + @Test + public void goBack() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + api.goBack(instance ); + + verify(instance).goBack(); + } + + @Test + public void goForward() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + api.goForward(instance ); + + verify(instance).goForward(); + } + + @Test + public void reload() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + api.reload(instance ); + + verify(instance).reload(); + } + + @Test + public void clearCache() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final Boolean includeDiskFiles = true; + api.clearCache(instance, includeDiskFiles); + + verify(instance).clearCache(includeDiskFiles); + } + + @Test + public void evaluateJavascript() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final String javascriptString = "myString"; + final String value = "myString"; + when(instance.evaluateJavascript(javascriptString)).thenReturn(value); + + assertEquals(value, api.evaluateJavascript(instance, javascriptString)); + } + + @Test + public void getTitle() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final String value = "myString"; + when(instance.getTitle()).thenReturn(value); + + assertEquals(value, api.getTitle(instance )); + } + + @Test + public void setWebViewClient() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final android.webkit.WebViewClient client = mock(WebViewClient.class); + api.setWebViewClient(instance, client); + + verify(instance).setWebViewClient(client); + } + + @Test + public void addJavaScriptChannel() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final JavaScriptChannel channel = mock(JavaScriptChannel.class); + api.addJavaScriptChannel(instance, channel); + + verify(instance).addJavaScriptChannel(channel); + } + + @Test + public void removeJavaScriptChannel() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final String name = "myString"; + api.removeJavaScriptChannel(instance, name); + + verify(instance).removeJavaScriptChannel(name); + } + + @Test + public void setDownloadListener() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final android.webkit.DownloadListener listener = mock(DownloadListener.class); + api.setDownloadListener(instance, listener); + + verify(instance).setDownloadListener(listener); + } + + @Test + public void setWebChromeClient() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl client = mock(WebChromeClient.class); + api.setWebChromeClient(instance, client); + + verify(instance).setWebChromeClient(client); + } + + @Test + public void setBackgroundColor() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + final Long color = 0; + api.setBackgroundColor(instance, color); + + verify(instance).setBackgroundColor(color); + } + + @Test + public void destroy() { + final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + + final WebView instance = mock(WebView.class); + api.destroy(instance ); + + verify(instance).destroy(); + } + + @Test + public void onScrollChanged() { + final WebViewProxyApi mockApi = mock(WebViewProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewImpl instance = new WebViewImpl(mockApi); + final Long left = 0; + final Long top = 0; + final Long oldLeft = 0; + final Long oldTop = 0; + instance.onScrollChanged(left, top, oldLeft, oldTop); + + verify(mockApi).onScrollChanged(eq(instance), eq(left), eq(top), eq(oldLeft), eq(oldTop), any()); + } + +} +*/ +/** + * Manages settings state for a `WebView`. + * + * See https://developer.android.com/reference/android/webkit/WebSettings. + */ +@Suppress("UNCHECKED_CAST") +abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { + /** Sets whether the DOM storage API is enabled. */ + abstract fun setDomStorageEnabled(pigeon_instance: android.webkit.WebSettings, flag: Boolean) + + /** Tells JavaScript to open windows automatically. */ + abstract fun setJavaScriptCanOpenWindowsAutomatically(pigeon_instance: android.webkit.WebSettings, flag: Boolean) + + /** Sets whether the WebView whether supports multiple windows. */ abstract fun setSupportMultipleWindows(pigeon_instance: android.webkit.WebSettings, support: Boolean) /** Tells the WebView to enable JavaScript execution. */ @@ -2359,6 +3521,314 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebSettings; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebSettings}. + * 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 WebSettingsProxyApi extends PigeonApiWebSettings { + WebSettingsProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @Override + public void setDomStorageEnabled(@NonNull WebSettings pigeon_instance,@NonNull Boolean flag) { + pigeon_instance.setDomStorageEnabled(flag); + } + + @Override + public void setJavaScriptCanOpenWindowsAutomatically(@NonNull WebSettings pigeon_instance,@NonNull Boolean flag) { + pigeon_instance.setJavaScriptCanOpenWindowsAutomatically(flag); + } + + @Override + public void setSupportMultipleWindows(@NonNull WebSettings pigeon_instance,@NonNull Boolean support) { + pigeon_instance.setSupportMultipleWindows(support); + } + + @Override + public void setJavaScriptEnabled(@NonNull WebSettings pigeon_instance,@NonNull Boolean flag) { + pigeon_instance.setJavaScriptEnabled(flag); + } + + @Override + public void setUserAgentString(@NonNull WebSettings pigeon_instance,@Nullable String? userAgentString) { + pigeon_instance.setUserAgentString(userAgentString); + } + + @Override + public void setMediaPlaybackRequiresUserGesture(@NonNull WebSettings pigeon_instance,@NonNull Boolean require) { + pigeon_instance.setMediaPlaybackRequiresUserGesture(require); + } + + @Override + public void setSupportZoom(@NonNull WebSettings pigeon_instance,@NonNull Boolean support) { + pigeon_instance.setSupportZoom(support); + } + + @Override + public void setLoadWithOverviewMode(@NonNull WebSettings pigeon_instance,@NonNull Boolean overview) { + pigeon_instance.setLoadWithOverviewMode(overview); + } + + @Override + public void setUseWideViewPort(@NonNull WebSettings pigeon_instance,@NonNull Boolean use) { + pigeon_instance.setUseWideViewPort(use); + } + + @Override + public void setDisplayZoomControls(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { + pigeon_instance.setDisplayZoomControls(enabled); + } + + @Override + public void setBuiltInZoomControls(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { + pigeon_instance.setBuiltInZoomControls(enabled); + } + + @Override + public void setAllowFileAccess(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { + pigeon_instance.setAllowFileAccess(enabled); + } + + @Override + public void setAllowContentAccess(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { + pigeon_instance.setAllowContentAccess(enabled); + } + + @Override + public void setGeolocationEnabled(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { + pigeon_instance.setGeolocationEnabled(enabled); + } + + @Override + public void setTextZoom(@NonNull WebSettings pigeon_instance,@NonNull Long textZoom) { + pigeon_instance.setTextZoom(textZoom); + } + + @NonNull + @Override + public String getUserAgentString(@NonNull WebSettings pigeon_instance) { + return pigeon_instance.getUserAgentString(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebSettings; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebSettingsTest { + @Test + public void setDomStorageEnabled() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean flag = true; + api.setDomStorageEnabled(instance, flag); + + verify(instance).setDomStorageEnabled(flag); + } + + @Test + public void setJavaScriptCanOpenWindowsAutomatically() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean flag = true; + api.setJavaScriptCanOpenWindowsAutomatically(instance, flag); + + verify(instance).setJavaScriptCanOpenWindowsAutomatically(flag); + } + + @Test + public void setSupportMultipleWindows() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean support = true; + api.setSupportMultipleWindows(instance, support); + + verify(instance).setSupportMultipleWindows(support); + } + + @Test + public void setJavaScriptEnabled() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean flag = true; + api.setJavaScriptEnabled(instance, flag); + + verify(instance).setJavaScriptEnabled(flag); + } + + @Test + public void setUserAgentString() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final String userAgentString = "myString"; + api.setUserAgentString(instance, userAgentString); + + verify(instance).setUserAgentString(userAgentString); + } + + @Test + public void setMediaPlaybackRequiresUserGesture() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean require = true; + api.setMediaPlaybackRequiresUserGesture(instance, require); + + verify(instance).setMediaPlaybackRequiresUserGesture(require); + } + + @Test + public void setSupportZoom() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean support = true; + api.setSupportZoom(instance, support); + + verify(instance).setSupportZoom(support); + } + + @Test + public void setLoadWithOverviewMode() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean overview = true; + api.setLoadWithOverviewMode(instance, overview); + + verify(instance).setLoadWithOverviewMode(overview); + } + + @Test + public void setUseWideViewPort() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean use = true; + api.setUseWideViewPort(instance, use); + + verify(instance).setUseWideViewPort(use); + } + + @Test + public void setDisplayZoomControls() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean enabled = true; + api.setDisplayZoomControls(instance, enabled); + + verify(instance).setDisplayZoomControls(enabled); + } + + @Test + public void setBuiltInZoomControls() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean enabled = true; + api.setBuiltInZoomControls(instance, enabled); + + verify(instance).setBuiltInZoomControls(enabled); + } + + @Test + public void setAllowFileAccess() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean enabled = true; + api.setAllowFileAccess(instance, enabled); + + verify(instance).setAllowFileAccess(enabled); + } + + @Test + public void setAllowContentAccess() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean enabled = true; + api.setAllowContentAccess(instance, enabled); + + verify(instance).setAllowContentAccess(enabled); + } + + @Test + public void setGeolocationEnabled() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Boolean enabled = true; + api.setGeolocationEnabled(instance, enabled); + + verify(instance).setGeolocationEnabled(enabled); + } + + @Test + public void setTextZoom() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final Long textZoom = 0; + api.setTextZoom(instance, textZoom); + + verify(instance).setTextZoom(textZoom); + } + + @Test + public void getUserAgentString() { + final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); + + final WebSettings instance = mock(WebSettings.class); + final String value = "myString"; + when(instance.getUserAgentString()).thenReturn(value); + + assertEquals(value, api.getUserAgentString(instance )); + } + +} +*/ /** * A JavaScript interface for exposing Javascript callbacks to Dart. * @@ -2439,6 +3909,110 @@ abstract class PigeonApiJavaScriptChannel(open val pigeonRegistrar: AndroidWebki } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link JavaScriptChannel}. + * 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 JavaScriptChannelProxyApi extends PigeonApiJavaScriptChannel { + JavaScriptChannelProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + /** Implementation of {@link JavaScriptChannel} that passes arguments of callback methods to Dart. */ + static class JavaScriptChannelImpl extends JavaScriptChannel { + private final JavaScriptChannelProxyApi api; + JavaScriptChannelImpl(@NonNull JavaScriptChannelProxyApi api) { + this.api = api; + } + @Override + public void postMessage(@NonNull String message) { + api.getPigeonRegistrar().runOnMainThread(() -> api.postMessage(this, message, reply -> null)); + } + } + + @NonNull + @Override + public JavaScriptChannel pigeon_defaultConstructor(@NonNull String channelName) { + return JavaScriptChannelImpl(); + } + + @NonNull + @Override + public String channelName(JavaScriptChannel pigeon_instance) { + return pigeon_instance.getChannelName(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class JavaScriptChannelTest { + @Test + public void pigeon_defaultConstructor() { + final PigeonApiJavaScriptChannel api = new TestProxyApiRegistrar().getPigeonApiJavaScriptChannel(); + + assertTrue(api.pigeon_defaultConstructor() instanceof JavaScriptChannelProxyApi.JavaScriptChannel); + } + + @Test + public void channelName() { + final PigeonApiJavaScriptChannel api = new TestProxyApiRegistrar().getPigeonApiJavaScriptChannel(); + + final JavaScriptChannel instance = mock(JavaScriptChannel.class); + final String value = "myString"; + when(instance.getChannelName()).thenReturn(value); + + assertEquals(value, api.channelName(instance)); + } + + @Test + public void postMessage() { + final JavaScriptChannelProxyApi mockApi = mock(JavaScriptChannelProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final JavaScriptChannelImpl instance = new JavaScriptChannelImpl(mockApi); + final String message = "myString"; + instance.postMessage(message); + + verify(mockApi).postMessage(eq(instance), eq(message), any()); + } + +} +*/ /** * Receives various notifications and requests from a `WebView`. * @@ -2924,94 +4498,503 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib } } - /** - * Notify the host application that a request to automatically log in the - * user has been processed. - */ - fun onReceivedLoginRequest(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, realmArg: String, accountArg: String?, argsArg: String, callback: (Result) -> Unit) -{ - if (pigeonRegistrar.ignoreCallsToDart) { - callback( - Result.failure( - AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - return - } - val binaryMessenger = pigeonRegistrar.binaryMessenger - val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedLoginRequest" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_instanceArg, viewArg, realmArg, accountArg, argsArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } + /** + * Notify the host application that a request to automatically log in the + * user has been processed. + */ + fun onReceivedLoginRequest(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, realmArg: String, accountArg: String?, argsArg: String, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } + val binaryMessenger = pigeonRegistrar.binaryMessenger + val codec = pigeonRegistrar.codec + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedLoginRequest" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pigeon_instanceArg, viewArg, realmArg, accountArg, argsArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } + } + + /** + * Notifies the host application that an SSL error occurred while loading a + * resource. + */ + fun onReceivedSslError(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, handlerArg: android.webkit.SslErrorHandler, errorArg: android.net.http.SslError, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } + val binaryMessenger = pigeonRegistrar.binaryMessenger + val codec = pigeonRegistrar.codec + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedSslError" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pigeon_instanceArg, viewArg, handlerArg, errorArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } + } + + /** + * Notify the host application that the scale applied to the WebView has + * changed. + */ + fun onScaleChanged(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, oldScaleArg: Double, newScaleArg: Double, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } + val binaryMessenger = pigeonRegistrar.binaryMessenger + val codec = pigeonRegistrar.codec + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onScaleChanged" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pigeon_instanceArg, viewArg, oldScaleArg, newScaleArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } + } + +} + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebViewClient; +import android.webkit.WebView; +import android.webkit.WebResourceRequest; +import android.webkit.WebResourceResponse; +import android.webkit.WebResourceError; +import androidx.webkit.WebResourceErrorCompat; +import android.webkit.HttpAuthHandler; +import android.os.Message; +import android.webkit.ClientCertRequest; +import android.webkit.SslErrorHandler; +import android.net.http.SslError; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebViewClient}. + * 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 WebViewClientProxyApi extends PigeonApiWebViewClient { + WebViewClientProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + /** Implementation of {@link WebViewClient} that passes arguments of callback methods to Dart. */ + static class WebViewClientImpl extends WebViewClient { + private final WebViewClientProxyApi api; + WebViewClientImpl(@NonNull WebViewClientProxyApi api) { + this.api = api; + } + @Override + public void onPageStarted(@NonNull android.webkit.WebView webView, @NonNull String url) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onPageStarted(this, webView, url, reply -> null)); + } + @Override + public void onPageFinished(@NonNull android.webkit.WebView webView, @NonNull String url) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onPageFinished(this, webView, url, reply -> null)); + } + @Override + public void onReceivedHttpError(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebResourceRequest request, @NonNull android.webkit.WebResourceResponse response) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedHttpError(this, webView, request, response, reply -> null)); + } + @Override + public void onReceivedRequestError(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebResourceRequest request, @NonNull android.webkit.WebResourceError error) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedRequestError(this, webView, request, error, reply -> null)); + } + @Override + public void onReceivedRequestErrorCompat(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebResourceRequest request, @NonNull androidx.webkit.WebResourceErrorCompat error) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedRequestErrorCompat(this, webView, request, error, reply -> null)); + } + @Override + public void onReceivedError(@NonNull android.webkit.WebView webView, @NonNull Long errorCode, @NonNull String description, @NonNull String failingUrl) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedError(this, webView, errorCode, description, failingUrl, reply -> null)); + } + @Override + public void requestLoading(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebResourceRequest request) { + api.getPigeonRegistrar().runOnMainThread(() -> api.requestLoading(this, webView, request, reply -> null)); + } + @Override + public void urlLoading(@NonNull android.webkit.WebView webView, @NonNull String url) { + api.getPigeonRegistrar().runOnMainThread(() -> api.urlLoading(this, webView, url, reply -> null)); + } + @Override + public void doUpdateVisitedHistory(@NonNull android.webkit.WebView webView, @NonNull String url, @NonNull Boolean isReload) { + api.getPigeonRegistrar().runOnMainThread(() -> api.doUpdateVisitedHistory(this, webView, url, isReload, reply -> null)); + } + @Override + public void onReceivedHttpAuthRequest(@NonNull android.webkit.WebView webView, @NonNull android.webkit.HttpAuthHandler handler, @NonNull String host, @NonNull String realm) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedHttpAuthRequest(this, webView, handler, host, realm, reply -> null)); + } + @Override + public void onFormResubmission(@NonNull android.webkit.WebView view, @NonNull android.os.Message dontResend, @NonNull android.os.Message resend) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onFormResubmission(this, view, dontResend, resend, reply -> null)); + } + @Override + public void onLoadResource(@NonNull android.webkit.WebView view, @NonNull String url) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onLoadResource(this, view, url, reply -> null)); + } + @Override + public void onPageCommitVisible(@NonNull android.webkit.WebView view, @NonNull String url) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onPageCommitVisible(this, view, url, reply -> null)); + } + @Override + public void onReceivedClientCertRequest(@NonNull android.webkit.WebView view, @NonNull android.webkit.ClientCertRequest request) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedClientCertRequest(this, view, request, reply -> null)); + } + @Override + public void onReceivedLoginRequest(@NonNull android.webkit.WebView view, @NonNull String realm, @Nullable String? account, @NonNull String args) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedLoginRequest(this, view, realm, account, args, reply -> null)); + } + @Override + public void onReceivedSslError(@NonNull android.webkit.WebView view, @NonNull android.webkit.SslErrorHandler handler, @NonNull android.net.http.SslError error) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedSslError(this, view, handler, error, reply -> null)); + } + @Override + public void onScaleChanged(@NonNull android.webkit.WebView view, @NonNull Double oldScale, @NonNull Double newScale) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onScaleChanged(this, view, oldScale, newScale, reply -> null)); + } + } + + @NonNull + @Override + public WebViewClient pigeon_defaultConstructor() { + return WebViewClientImpl(); + } + + @Override + public void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull WebViewClient pigeon_instance,@NonNull Boolean value) { + pigeon_instance.setSynchronousReturnValueForShouldOverrideUrlLoading(value); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebViewClient; +import android.webkit.WebView; +import android.webkit.WebResourceRequest; +import android.webkit.WebResourceResponse; +import android.webkit.WebResourceError; +import androidx.webkit.WebResourceErrorCompat; +import android.webkit.HttpAuthHandler; +import android.os.Message; +import android.webkit.ClientCertRequest; +import android.webkit.SslErrorHandler; +import android.net.http.SslError; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebViewClientTest { + @Test + public void pigeon_defaultConstructor() { + final PigeonApiWebViewClient api = new TestProxyApiRegistrar().getPigeonApiWebViewClient(); + + assertTrue(api.pigeon_defaultConstructor() instanceof WebViewClientProxyApi.WebViewClient); + } + + @Test + public void setSynchronousReturnValueForShouldOverrideUrlLoading() { + final PigeonApiWebViewClient api = new TestProxyApiRegistrar().getPigeonApiWebViewClient(); + + final WebViewClient instance = mock(WebViewClient.class); + final Boolean value = true; + api.setSynchronousReturnValueForShouldOverrideUrlLoading(instance, value); + + verify(instance).setSynchronousReturnValueForShouldOverrideUrlLoading(value); + } + + @Test + public void onPageStarted() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final String url = "myString"; + instance.onPageStarted(webView, url); + + verify(mockApi).onPageStarted(eq(instance), eq(webView), eq(url), any()); + } + + @Test + public void onPageFinished() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final String url = "myString"; + instance.onPageFinished(webView, url); + + verify(mockApi).onPageFinished(eq(instance), eq(webView), eq(url), any()); + } + + @Test + public void onReceivedHttpError() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final android.webkit.WebResourceRequest request = mock(WebResourceRequest.class); + final android.webkit.WebResourceResponse response = mock(WebResourceResponse.class); + instance.onReceivedHttpError(webView, request, response); + + verify(mockApi).onReceivedHttpError(eq(instance), eq(webView), eq(request), eq(response), any()); + } + + @Test + public void onReceivedRequestError() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final android.webkit.WebResourceRequest request = mock(WebResourceRequest.class); + final android.webkit.WebResourceError error = mock(WebResourceError.class); + instance.onReceivedRequestError(webView, request, error); + + verify(mockApi).onReceivedRequestError(eq(instance), eq(webView), eq(request), eq(error), any()); + } + + @Test + public void onReceivedRequestErrorCompat() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final android.webkit.WebResourceRequest request = mock(WebResourceRequest.class); + final androidx.webkit.WebResourceErrorCompat error = mock(WebResourceErrorCompat.class); + instance.onReceivedRequestErrorCompat(webView, request, error); + + verify(mockApi).onReceivedRequestErrorCompat(eq(instance), eq(webView), eq(request), eq(error), any()); + } + + @Test + public void onReceivedError() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final Long errorCode = 0; + final String description = "myString"; + final String failingUrl = "myString"; + instance.onReceivedError(webView, errorCode, description, failingUrl); + + verify(mockApi).onReceivedError(eq(instance), eq(webView), eq(errorCode), eq(description), eq(failingUrl), any()); + } + + @Test + public void requestLoading() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final android.webkit.WebResourceRequest request = mock(WebResourceRequest.class); + instance.requestLoading(webView, request); + + verify(mockApi).requestLoading(eq(instance), eq(webView), eq(request), any()); + } + + @Test + public void urlLoading() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final String url = "myString"; + instance.urlLoading(webView, url); + + verify(mockApi).urlLoading(eq(instance), eq(webView), eq(url), any()); + } + + @Test + public void doUpdateVisitedHistory() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final String url = "myString"; + final Boolean isReload = true; + instance.doUpdateVisitedHistory(webView, url, isReload); + + verify(mockApi).doUpdateVisitedHistory(eq(instance), eq(webView), eq(url), eq(isReload), any()); + } + + @Test + public void onReceivedHttpAuthRequest() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final android.webkit.HttpAuthHandler handler = mock(HttpAuthHandler.class); + final String host = "myString"; + final String realm = "myString"; + instance.onReceivedHttpAuthRequest(webView, handler, host, realm); + + verify(mockApi).onReceivedHttpAuthRequest(eq(instance), eq(webView), eq(handler), eq(host), eq(realm), any()); + } + + @Test + public void onFormResubmission() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView view = mock(WebView.class); + final android.os.Message dontResend = mock(AndroidMessage.class); + final android.os.Message resend = mock(AndroidMessage.class); + instance.onFormResubmission(view, dontResend, resend); + + verify(mockApi).onFormResubmission(eq(instance), eq(view), eq(dontResend), eq(resend), any()); + } + + @Test + public void onLoadResource() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView view = mock(WebView.class); + final String url = "myString"; + instance.onLoadResource(view, url); + + verify(mockApi).onLoadResource(eq(instance), eq(view), eq(url), any()); + } + + @Test + public void onPageCommitVisible() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView view = mock(WebView.class); + final String url = "myString"; + instance.onPageCommitVisible(view, url); + + verify(mockApi).onPageCommitVisible(eq(instance), eq(view), eq(url), any()); } - /** - * Notifies the host application that an SSL error occurred while loading a - * resource. - */ - fun onReceivedSslError(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, handlerArg: android.webkit.SslErrorHandler, errorArg: android.net.http.SslError, callback: (Result) -> Unit) -{ - if (pigeonRegistrar.ignoreCallsToDart) { - callback( - Result.failure( - AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - return - } - val binaryMessenger = pigeonRegistrar.binaryMessenger - val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedSslError" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_instanceArg, viewArg, handlerArg, errorArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } + @Test + public void onReceivedClientCertRequest() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView view = mock(WebView.class); + final android.webkit.ClientCertRequest request = mock(ClientCertRequest.class); + instance.onReceivedClientCertRequest(view, request); + + verify(mockApi).onReceivedClientCertRequest(eq(instance), eq(view), eq(request), any()); } - /** - * Notify the host application that the scale applied to the WebView has - * changed. - */ - fun onScaleChanged(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, oldScaleArg: Double, newScaleArg: Double, callback: (Result) -> Unit) -{ - if (pigeonRegistrar.ignoreCallsToDart) { - callback( - Result.failure( - AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - return - } - val binaryMessenger = pigeonRegistrar.binaryMessenger - val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onScaleChanged" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_instanceArg, viewArg, oldScaleArg, newScaleArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } + @Test + public void onReceivedLoginRequest() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView view = mock(WebView.class); + final String realm = "myString"; + final String account = "myString"; + final String args = "myString"; + instance.onReceivedLoginRequest(view, realm, account, args); + + verify(mockApi).onReceivedLoginRequest(eq(instance), eq(view), eq(realm), eq(account), eq(args), any()); + } + + @Test + public void onReceivedSslError() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView view = mock(WebView.class); + final android.webkit.SslErrorHandler handler = mock(SslErrorHandler.class); + final android.net.http.SslError error = mock(SslError.class); + instance.onReceivedSslError(view, handler, error); + + verify(mockApi).onReceivedSslError(eq(instance), eq(view), eq(handler), eq(error), any()); + } + + @Test + public void onScaleChanged() { + final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebViewClientImpl instance = new WebViewClientImpl(mockApi); + final android.webkit.WebView view = mock(WebView.class); + final Double oldScale = 1.0; + final Double newScale = 1.0; + instance.onScaleChanged(view, oldScale, newScale); + + verify(mockApi).onScaleChanged(eq(instance), eq(view), eq(oldScale), eq(newScale), any()); } } +*/ /** * Handles notifications that a file should be downloaded. * @@ -3090,6 +5073,97 @@ abstract class PigeonApiDownloadListener(open val pigeonRegistrar: AndroidWebkit } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.DownloadListener; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link DownloadListener}. + * 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 DownloadListenerProxyApi extends PigeonApiDownloadListener { + DownloadListenerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + /** Implementation of {@link DownloadListener} that passes arguments of callback methods to Dart. */ + static class DownloadListenerImpl extends DownloadListener { + private final DownloadListenerProxyApi api; + DownloadListenerImpl(@NonNull DownloadListenerProxyApi api) { + this.api = api; + } + @Override + public void onDownloadStart(@NonNull String url, @NonNull String userAgent, @NonNull String contentDisposition, @NonNull String mimetype, @NonNull Long contentLength) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onDownloadStart(this, url, userAgent, contentDisposition, mimetype, contentLength, reply -> null)); + } + } + + @NonNull + @Override + public DownloadListener pigeon_defaultConstructor() { + return DownloadListenerImpl(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.DownloadListener; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class DownloadListenerTest { + @Test + public void pigeon_defaultConstructor() { + final PigeonApiDownloadListener api = new TestProxyApiRegistrar().getPigeonApiDownloadListener(); + + assertTrue(api.pigeon_defaultConstructor() instanceof DownloadListenerProxyApi.DownloadListenerImpl); + } + + @Test + public void onDownloadStart() { + final DownloadListenerProxyApi mockApi = mock(DownloadListenerProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final DownloadListenerImpl instance = new DownloadListenerImpl(mockApi); + final String url = "myString"; + final String userAgent = "myString"; + final String contentDisposition = "myString"; + final String mimetype = "myString"; + final Long contentLength = 0; + instance.onDownloadStart(url, userAgent, contentDisposition, mimetype, contentLength); + + verify(mockApi).onDownloadStart(eq(instance), eq(url), eq(userAgent), eq(contentDisposition), eq(mimetype), eq(contentLength), any()); + } + +} +*/ /** * Handles notification of JavaScript dialogs, favicons, titles, and the * progress. @@ -3611,37 +5685,387 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } } - /** - * Notify the host application that the web page wants to display a - * JavaScript `prompt()` dialog. - */ - fun onJsPrompt(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, urlArg: String, messageArg: String, defaultValueArg: String, callback: (Result) -> Unit) -{ - if (pigeonRegistrar.ignoreCallsToDart) { - callback( - Result.failure( - AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - return - } - val binaryMessenger = pigeonRegistrar.binaryMessenger - val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onJsPrompt" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, messageArg, defaultValueArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - val output = it[0] as String? - callback(Result.success(output)) - } - } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } + /** + * Notify the host application that the web page wants to display a + * JavaScript `prompt()` dialog. + */ + fun onJsPrompt(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, urlArg: String, messageArg: String, defaultValueArg: String, callback: (Result) -> Unit) +{ + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + return + } + val binaryMessenger = pigeonRegistrar.binaryMessenger + val codec = pigeonRegistrar.codec + val channelName = "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onJsPrompt" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, messageArg, defaultValueArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + val output = it[0] as String? + callback(Result.success(output)) + } + } else { + callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } + } + +} + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl; +import android.webkit.WebView; +import android.webkit.WebChromeClient.FileChooserParams; +import android.webkit.PermissionRequest; +import android.view.View; +import android.webkit.WebChromeClient.CustomViewCallback; +import android.webkit.GeolocationPermissions.Callback; +import android.webkit.ConsoleMessage; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebChromeClient}. + * 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 WebChromeClientProxyApi extends PigeonApiWebChromeClient { + WebChromeClientProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + /** Implementation of {@link WebChromeClient} that passes arguments of callback methods to Dart. */ + static class WebChromeClientImpl extends WebChromeClient { + private final WebChromeClientProxyApi api; + WebChromeClientImpl(@NonNull WebChromeClientProxyApi api) { + this.api = api; + } + @Override + public void onProgressChanged(@NonNull android.webkit.WebView webView, @NonNull Long progress) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onProgressChanged(this, webView, progress, reply -> null)); + } + @Override + public void onShowFileChooser(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebChromeClient.FileChooserParams params) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onShowFileChooser(this, webView, params, reply -> null)); + } + @Override + public void onPermissionRequest(@NonNull android.webkit.PermissionRequest request) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onPermissionRequest(this, request, reply -> null)); + } + @Override + public void onShowCustomView(@NonNull android.view.View view, @NonNull android.webkit.WebChromeClient.CustomViewCallback callback) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onShowCustomView(this, view, callback, reply -> null)); + } + @Override + public void onHideCustomView() { + api.getPigeonRegistrar().runOnMainThread(() -> api.onHideCustomView(this , reply -> null)); + } + @Override + public void onGeolocationPermissionsShowPrompt(@NonNull String origin, @NonNull android.webkit.GeolocationPermissions.Callback callback) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onGeolocationPermissionsShowPrompt(this, origin, callback, reply -> null)); + } + @Override + public void onGeolocationPermissionsHidePrompt() { + api.getPigeonRegistrar().runOnMainThread(() -> api.onGeolocationPermissionsHidePrompt(this , reply -> null)); + } + @Override + public void onConsoleMessage(@NonNull android.webkit.ConsoleMessage message) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onConsoleMessage(this, message, reply -> null)); + } + @Override + public void onJsAlert(@NonNull android.webkit.WebView webView, @NonNull String url, @NonNull String message) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onJsAlert(this, webView, url, message, reply -> null)); + } + @Override + public void onJsConfirm(@NonNull android.webkit.WebView webView, @NonNull String url, @NonNull String message) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onJsConfirm(this, webView, url, message, reply -> null)); + } + @Override + public void onJsPrompt(@NonNull android.webkit.WebView webView, @NonNull String url, @NonNull String message, @NonNull String defaultValue) { + api.getPigeonRegistrar().runOnMainThread(() -> api.onJsPrompt(this, webView, url, message, defaultValue, reply -> null)); + } + } + + @NonNull + @Override + public WebChromeClient pigeon_defaultConstructor() { + return WebChromeClientImpl(); + } + + @Override + public void setSynchronousReturnValueForOnShowFileChooser(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { + pigeon_instance.setSynchronousReturnValueForOnShowFileChooser(value); + } + + @Override + public void setSynchronousReturnValueForOnConsoleMessage(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { + pigeon_instance.setSynchronousReturnValueForOnConsoleMessage(value); + } + + @Override + public void setSynchronousReturnValueForOnJsAlert(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { + pigeon_instance.setSynchronousReturnValueForOnJsAlert(value); + } + + @Override + public void setSynchronousReturnValueForOnJsConfirm(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { + pigeon_instance.setSynchronousReturnValueForOnJsConfirm(value); + } + + @Override + public void setSynchronousReturnValueForOnJsPrompt(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { + pigeon_instance.setSynchronousReturnValueForOnJsPrompt(value); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl; +import android.webkit.WebView; +import android.webkit.WebChromeClient.FileChooserParams; +import android.webkit.PermissionRequest; +import android.view.View; +import android.webkit.WebChromeClient.CustomViewCallback; +import android.webkit.GeolocationPermissions.Callback; +import android.webkit.ConsoleMessage; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebChromeClientTest { + @Test + public void pigeon_defaultConstructor() { + final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); + + assertTrue(api.pigeon_defaultConstructor() instanceof WebChromeClientProxyApi.WebChromeClient); + } + + @Test + public void setSynchronousReturnValueForOnShowFileChooser() { + final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); + + final WebChromeClient instance = mock(WebChromeClient.class); + final Boolean value = true; + api.setSynchronousReturnValueForOnShowFileChooser(instance, value); + + verify(instance).setSynchronousReturnValueForOnShowFileChooser(value); + } + + @Test + public void setSynchronousReturnValueForOnConsoleMessage() { + final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); + + final WebChromeClient instance = mock(WebChromeClient.class); + final Boolean value = true; + api.setSynchronousReturnValueForOnConsoleMessage(instance, value); + + verify(instance).setSynchronousReturnValueForOnConsoleMessage(value); + } + + @Test + public void setSynchronousReturnValueForOnJsAlert() { + final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); + + final WebChromeClient instance = mock(WebChromeClient.class); + final Boolean value = true; + api.setSynchronousReturnValueForOnJsAlert(instance, value); + + verify(instance).setSynchronousReturnValueForOnJsAlert(value); + } + + @Test + public void setSynchronousReturnValueForOnJsConfirm() { + final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); + + final WebChromeClient instance = mock(WebChromeClient.class); + final Boolean value = true; + api.setSynchronousReturnValueForOnJsConfirm(instance, value); + + verify(instance).setSynchronousReturnValueForOnJsConfirm(value); + } + + @Test + public void setSynchronousReturnValueForOnJsPrompt() { + final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); + + final WebChromeClient instance = mock(WebChromeClient.class); + final Boolean value = true; + api.setSynchronousReturnValueForOnJsPrompt(instance, value); + + verify(instance).setSynchronousReturnValueForOnJsPrompt(value); + } + + @Test + public void onProgressChanged() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final Long progress = 0; + instance.onProgressChanged(webView, progress); + + verify(mockApi).onProgressChanged(eq(instance), eq(webView), eq(progress), any()); + } + + @Test + public void onShowFileChooser() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final android.webkit.WebChromeClient.FileChooserParams params = mock(FileChooserParams.class); + instance.onShowFileChooser(webView, params); + + verify(mockApi).onShowFileChooser(eq(instance), eq(webView), eq(params), any()); + } + + @Test + public void onPermissionRequest() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final android.webkit.PermissionRequest request = mock(PermissionRequest.class); + instance.onPermissionRequest(request); + + verify(mockApi).onPermissionRequest(eq(instance), eq(request), any()); + } + + @Test + public void onShowCustomView() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final android.view.View view = mock(View.class); + final android.webkit.WebChromeClient.CustomViewCallback callback = mock(CustomViewCallback.class); + instance.onShowCustomView(view, callback); + + verify(mockApi).onShowCustomView(eq(instance), eq(view), eq(callback), any()); + } + + @Test + public void onHideCustomView() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + instance.onHideCustomView(); + + verify(mockApi).onHideCustomView(eq(instance) , any()); + } + + @Test + public void onGeolocationPermissionsShowPrompt() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final String origin = "myString"; + final android.webkit.GeolocationPermissions.Callback callback = mock(GeolocationPermissionsCallback.class); + instance.onGeolocationPermissionsShowPrompt(origin, callback); + + verify(mockApi).onGeolocationPermissionsShowPrompt(eq(instance), eq(origin), eq(callback), any()); + } + + @Test + public void onGeolocationPermissionsHidePrompt() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + instance.onGeolocationPermissionsHidePrompt(); + + verify(mockApi).onGeolocationPermissionsHidePrompt(eq(instance) , any()); + } + + @Test + public void onConsoleMessage() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final android.webkit.ConsoleMessage message = mock(ConsoleMessage.class); + instance.onConsoleMessage(message); + + verify(mockApi).onConsoleMessage(eq(instance), eq(message), any()); + } + + @Test + public void onJsAlert() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final String url = "myString"; + final String message = "myString"; + instance.onJsAlert(webView, url, message); + + verify(mockApi).onJsAlert(eq(instance), eq(webView), eq(url), eq(message), any()); + } + + @Test + public void onJsConfirm() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final String url = "myString"; + final String message = "myString"; + instance.onJsConfirm(webView, url, message); + + verify(mockApi).onJsConfirm(eq(instance), eq(webView), eq(url), eq(message), any()); + } + + @Test + public void onJsPrompt() { + final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); + when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); + + final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); + final android.webkit.WebView webView = mock(WebView.class); + final String url = "myString"; + final String message = "myString"; + final String defaultValue = "myString"; + instance.onJsPrompt(webView, url, message, defaultValue); + + verify(mockApi).onJsPrompt(eq(instance), eq(webView), eq(url), eq(message), eq(defaultValue), any()); } } +*/ /** * Provides access to the assets registered as part of the App bundle. * @@ -3762,6 +6186,99 @@ abstract class PigeonApiFlutterAssetManager(open val pigeonRegistrar: AndroidWeb } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import io.flutter.plugins.webviewflutter.FlutterAssetManager; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link FlutterAssetManager}. + * 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 FlutterAssetManagerProxyApi extends PigeonApiFlutterAssetManager { + FlutterAssetManagerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public io.flutter.plugins.webviewflutter.FlutterAssetManager instance() { + return FlutterAssetManager.getInstance(); + } + + @NonNull + @Override + public List list(@NonNull FlutterAssetManager pigeon_instance,@NonNull String path) { + return pigeon_instance.list(path); + } + + @NonNull + @Override + public String getAssetFilePathByName(@NonNull FlutterAssetManager pigeon_instance,@NonNull String name) { + return pigeon_instance.getAssetFilePathByName(name); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import io.flutter.plugins.webviewflutter.FlutterAssetManager; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class FlutterAssetManagerTest { + @Test + public void list() { + final PigeonApiFlutterAssetManager api = new TestProxyApiRegistrar().getPigeonApiFlutterAssetManager(); + + final FlutterAssetManager instance = mock(FlutterAssetManager.class); + final String path = "myString"; + final List value = Arrays.asList("myString"); + when(instance.list(path)).thenReturn(value); + + assertEquals(value, api.list(instance, path)); + } + + @Test + public void getAssetFilePathByName() { + final PigeonApiFlutterAssetManager api = new TestProxyApiRegistrar().getPigeonApiFlutterAssetManager(); + + final FlutterAssetManager instance = mock(FlutterAssetManager.class); + final String name = "myString"; + final String value = "myString"; + when(instance.getAssetFilePathByName(name)).thenReturn(value); + + assertEquals(value, api.getAssetFilePathByName(instance, name)); + } + +} +*/ /** * This class is used to manage the JavaScript storage APIs provided by the * WebView. @@ -3849,6 +6366,78 @@ abstract class PigeonApiWebStorage(open val pigeonRegistrar: AndroidWebkitLibrar } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebStorage; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link WebStorage}. + * 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 WebStorageProxyApi extends PigeonApiWebStorage { + WebStorageProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public android.webkit.WebStorage instance() { + return WebStorage.getInstance(); + } + + @Override + public void deleteAllData(@NonNull WebStorage pigeon_instance) { + pigeon_instance.deleteAllData(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebStorage; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class WebStorageTest { + @Test + public void deleteAllData() { + final PigeonApiWebStorage api = new TestProxyApiRegistrar().getPigeonApiWebStorage(); + + final WebStorage instance = mock(WebStorage.class); + api.deleteAllData(instance ); + + verify(instance).deleteAllData(); + } + +} +*/ /** * Parameters used in the `WebChromeClient.onShowFileChooser` method. * @@ -3903,6 +6492,130 @@ abstract class PigeonApiFileChooserParams(open val pigeonRegistrar: AndroidWebki } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebChromeClient.FileChooserParams; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link FileChooserParams}. + * 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 FileChooserParamsProxyApi extends PigeonApiFileChooserParams { + FileChooserParamsProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public Boolean isCaptureEnabled(FileChooserParams pigeon_instance) { + return pigeon_instance.getIsCaptureEnabled(); + } + + @NonNull + @Override + public List acceptTypes(FileChooserParams pigeon_instance) { + return pigeon_instance.getAcceptTypes(); + } + + @NonNull + @Override + public FileChooserMode mode(FileChooserParams pigeon_instance) { + switch (pigeon_instance.mode) { + case FileChooserMode.OPEN: return io.flutter.plugins.webviewflutter.FileChooserMode.OPEN; + case FileChooserMode.OPEN_MULTIPLE: return io.flutter.plugins.webviewflutter.FileChooserMode.OPEN_MULTIPLE; + case FileChooserMode.SAVE: return io.flutter.plugins.webviewflutter.FileChooserMode.SAVE; + default: return io.flutter.plugins.webviewflutter.FileChooserMode.UNKNOWN; + } + } + + @Nullable + @Override + public String? filenameHint(FileChooserParams pigeon_instance) { + return pigeon_instance.getFilenameHint(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebChromeClient.FileChooserParams; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class FileChooserParamsTest { + @Test + public void isCaptureEnabled() { + final PigeonApiFileChooserParams api = new TestProxyApiRegistrar().getPigeonApiFileChooserParams(); + + final FileChooserParams instance = mock(FileChooserParams.class); + final Boolean value = true; + when(instance.getIsCaptureEnabled()).thenReturn(value); + + assertEquals(value, api.isCaptureEnabled(instance)); + } + + @Test + public void acceptTypes() { + final PigeonApiFileChooserParams api = new TestProxyApiRegistrar().getPigeonApiFileChooserParams(); + + final FileChooserParams instance = mock(FileChooserParams.class); + final List value = Arrays.asList("myString"); + when(instance.getAcceptTypes()).thenReturn(value); + + assertEquals(value, api.acceptTypes(instance)); + } + + @Test + public void mode() { + final PigeonApiFileChooserParams api = new TestProxyApiRegistrar().getPigeonApiFileChooserParams(); + + final FileChooserParams instance = mock(FileChooserParams.class); + final FileChooserMode value = io.flutter.plugins.webviewflutter.FileChooserMode.OPEN; + when(instance.getMode()).thenReturn(value); + + assertEquals(value, api.mode(instance)); + } + + @Test + public void filenameHint() { + final PigeonApiFileChooserParams api = new TestProxyApiRegistrar().getPigeonApiFileChooserParams(); + + final FileChooserParams instance = mock(FileChooserParams.class); + final String value = "myString"; + when(instance.getFilenameHint()).thenReturn(value); + + assertEquals(value, api.filenameHint(instance)); + } + +} +*/ /** * This class defines a permission request and is used when web content * requests access to protected resources. @@ -3998,6 +6711,105 @@ abstract class PigeonApiPermissionRequest(open val pigeonRegistrar: AndroidWebki } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.PermissionRequest; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link PermissionRequest}. + * 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 PermissionRequestProxyApi extends PigeonApiPermissionRequest { + PermissionRequestProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public List resources(PermissionRequest pigeon_instance) { + return pigeon_instance.getResources(); + } + + @Override + public void grant(@NonNull PermissionRequest pigeon_instance,@NonNull List resources) { + pigeon_instance.grant(resources); + } + + @Override + public void deny(@NonNull PermissionRequest pigeon_instance) { + pigeon_instance.deny(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.PermissionRequest; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class PermissionRequestTest { + @Test + public void resources() { + final PigeonApiPermissionRequest api = new TestProxyApiRegistrar().getPigeonApiPermissionRequest(); + + final PermissionRequest instance = mock(PermissionRequest.class); + final List value = Arrays.asList("myString"); + when(instance.getResources()).thenReturn(value); + + assertEquals(value, api.resources(instance)); + } + + @Test + public void grant() { + final PigeonApiPermissionRequest api = new TestProxyApiRegistrar().getPigeonApiPermissionRequest(); + + final PermissionRequest instance = mock(PermissionRequest.class); + final List resources = Arrays.asList("myString"); + api.grant(instance, resources); + + verify(instance).grant(resources); + } + + @Test + public void deny() { + final PigeonApiPermissionRequest api = new TestProxyApiRegistrar().getPigeonApiPermissionRequest(); + + final PermissionRequest instance = mock(PermissionRequest.class); + api.deny(instance ); + + verify(instance).deny(); + } + +} +*/ /** * A callback interface used by the host application to notify the current page * that its custom view has been dismissed. @@ -4065,6 +6877,72 @@ abstract class PigeonApiCustomViewCallback(open val pigeonRegistrar: AndroidWebk } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebChromeClient.CustomViewCallback; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link CustomViewCallback}. + * 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 CustomViewCallbackProxyApi extends PigeonApiCustomViewCallback { + CustomViewCallbackProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @Override + public void onCustomViewHidden(@NonNull CustomViewCallback pigeon_instance) { + pigeon_instance.onCustomViewHidden(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.WebChromeClient.CustomViewCallback; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class CustomViewCallbackTest { + @Test + public void onCustomViewHidden() { + final PigeonApiCustomViewCallback api = new TestProxyApiRegistrar().getPigeonApiCustomViewCallback(); + + final CustomViewCallback instance = mock(CustomViewCallback.class); + api.onCustomViewHidden(instance ); + + verify(instance).onCustomViewHidden(); + } + +} +*/ /** * This class represents the basic building block for user interface * components. @@ -4199,6 +7077,124 @@ abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeo } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.view.View; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link View}. + * 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 ViewProxyApi extends PigeonApiView { + ViewProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @Override + public void scrollTo(@NonNull View pigeon_instance,@NonNull Long x, @NonNull Long y) { + pigeon_instance.scrollTo(x, y); + } + + @Override + public void scrollBy(@NonNull View pigeon_instance,@NonNull Long x, @NonNull Long y) { + pigeon_instance.scrollBy(x, y); + } + + @NonNull + @Override + public WebViewPoint getScrollPosition(@NonNull View pigeon_instance) { + return pigeon_instance.getScrollPosition(); + } + + @Override + public void setOverScrollMode(@NonNull View pigeon_instance,@NonNull OverScrollMode mode) { + pigeon_instance.setOverScrollMode(mode); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.view.View; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class ViewTest { + @Test + public void scrollTo() { + final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); + + final View instance = mock(View.class); + final Long x = 0; + final Long y = 0; + api.scrollTo(instance, x, y); + + verify(instance).scrollTo(x, y); + } + + @Test + public void scrollBy() { + final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); + + final View instance = mock(View.class); + final Long x = 0; + final Long y = 0; + api.scrollBy(instance, x, y); + + verify(instance).scrollBy(x, y); + } + + @Test + public void getScrollPosition() { + final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); + + final View instance = mock(View.class); + final WebViewPoint value = mock(WebViewPoint.class); + when(instance.getScrollPosition()).thenReturn(value); + + assertEquals(value, api.getScrollPosition(instance )); + } + + @Test + public void setOverScrollMode() { + final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); + + final View instance = mock(View.class); + final OverScrollMode mode = io.flutter.plugins.webviewflutter.OverScrollMode.ALWAYS; + api.setOverScrollMode(instance, mode); + + verify(instance).setOverScrollMode(mode); + } + +} +*/ /** * A callback interface used by the host application to set the Geolocation * permission state for an origin. @@ -4269,6 +7265,75 @@ abstract class PigeonApiGeolocationPermissionsCallback(open val pigeonRegistrar: } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.GeolocationPermissions.Callback; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link GeolocationPermissionsCallback}. + * 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 GeolocationPermissionsCallbackProxyApi extends PigeonApiGeolocationPermissionsCallback { + GeolocationPermissionsCallbackProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @Override + public void invoke(@NonNull GeolocationPermissionsCallback pigeon_instance,@NonNull String origin, @NonNull Boolean allow, @NonNull Boolean retain) { + pigeon_instance.invoke(origin, allow, retain); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.GeolocationPermissions.Callback; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class GeolocationPermissionsCallbackTest { + @Test + public void invoke() { + final PigeonApiGeolocationPermissionsCallback api = new TestProxyApiRegistrar().getPigeonApiGeolocationPermissionsCallback(); + + final GeolocationPermissionsCallback instance = mock(GeolocationPermissionsCallback.class); + final String origin = "myString"; + final Boolean allow = true; + final Boolean retain = true; + api.invoke(instance, origin, allow, retain); + + verify(instance).invoke(origin, allow, retain); + } + +} +*/ /** * Represents a request for HTTP authentication. * @@ -4385,6 +7450,106 @@ abstract class PigeonApiHttpAuthHandler(open val pigeonRegistrar: AndroidWebkitL } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.HttpAuthHandler; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link HttpAuthHandler}. + * 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 HttpAuthHandlerProxyApi extends PigeonApiHttpAuthHandler { + HttpAuthHandlerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public Boolean useHttpAuthUsernamePassword(@NonNull HttpAuthHandler pigeon_instance) { + return pigeon_instance.useHttpAuthUsernamePassword(); + } + + @Override + public void cancel(@NonNull HttpAuthHandler pigeon_instance) { + pigeon_instance.cancel(); + } + + @Override + public void proceed(@NonNull HttpAuthHandler pigeon_instance,@NonNull String username, @NonNull String password) { + pigeon_instance.proceed(username, password); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.HttpAuthHandler; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class HttpAuthHandlerTest { + @Test + public void useHttpAuthUsernamePassword() { + final PigeonApiHttpAuthHandler api = new TestProxyApiRegistrar().getPigeonApiHttpAuthHandler(); + + final HttpAuthHandler instance = mock(HttpAuthHandler.class); + final Boolean value = true; + when(instance.useHttpAuthUsernamePassword()).thenReturn(value); + + assertEquals(value, api.useHttpAuthUsernamePassword(instance )); + } + + @Test + public void cancel() { + final PigeonApiHttpAuthHandler api = new TestProxyApiRegistrar().getPigeonApiHttpAuthHandler(); + + final HttpAuthHandler instance = mock(HttpAuthHandler.class); + api.cancel(instance ); + + verify(instance).cancel(); + } + + @Test + public void proceed() { + final PigeonApiHttpAuthHandler api = new TestProxyApiRegistrar().getPigeonApiHttpAuthHandler(); + + final HttpAuthHandler instance = mock(HttpAuthHandler.class); + final String username = "myString"; + final String password = "myString"; + api.proceed(instance, username, password); + + verify(instance).proceed(username, password); + } + +} +*/ /** * Defines a message containing a description and arbitrary data object that * can be sent to a `Handler`. @@ -4457,6 +7622,72 @@ abstract class PigeonApiAndroidMessage(open val pigeonRegistrar: AndroidWebkitLi } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.os.Message; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link AndroidMessage}. + * 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 AndroidMessageProxyApi extends PigeonApiAndroidMessage { + AndroidMessageProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @Override + public void sendToTarget(@NonNull AndroidMessage pigeon_instance) { + pigeon_instance.sendToTarget(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.os.Message; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class MessageTest { + @Test + public void sendToTarget() { + final PigeonApiAndroidMessage api = new TestProxyApiRegistrar().getPigeonApiAndroidMessage(); + + final AndroidMessage instance = mock(AndroidMessage.class); + api.sendToTarget(instance ); + + verify(instance).sendToTarget(); + } + +} +*/ /** * Defines a message containing a description and arbitrary data object that * can be sent to a `Handler`. @@ -4568,6 +7799,108 @@ abstract class PigeonApiClientCertRequest(open val pigeonRegistrar: AndroidWebki } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.ClientCertRequest; +import java.security.cert.X509Certificate; +import java.security.PrivateKey; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link ClientCertRequest}. + * 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 ClientCertRequestProxyApi extends PigeonApiClientCertRequest { + ClientCertRequestProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @Override + public void cancel(@NonNull ClientCertRequest pigeon_instance) { + pigeon_instance.cancel(); + } + + @Override + public void ignore(@NonNull ClientCertRequest pigeon_instance) { + pigeon_instance.ignore(); + } + + @Override + public void proceed(@NonNull ClientCertRequest pigeon_instance,@NonNull java.security.PrivateKey privateKey, @NonNull List chain) { + pigeon_instance.proceed(privateKey, chain); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.ClientCertRequest; +import java.security.cert.X509Certificate; +import java.security.PrivateKey; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class ClientCertRequestTest { + @Test + public void cancel() { + final PigeonApiClientCertRequest api = new TestProxyApiRegistrar().getPigeonApiClientCertRequest(); + + final ClientCertRequest instance = mock(ClientCertRequest.class); + api.cancel(instance ); + + verify(instance).cancel(); + } + + @Test + public void ignore() { + final PigeonApiClientCertRequest api = new TestProxyApiRegistrar().getPigeonApiClientCertRequest(); + + final ClientCertRequest instance = mock(ClientCertRequest.class); + api.ignore(instance ); + + verify(instance).ignore(); + } + + @Test + public void proceed() { + final PigeonApiClientCertRequest api = new TestProxyApiRegistrar().getPigeonApiClientCertRequest(); + + final ClientCertRequest instance = mock(ClientCertRequest.class); + final java.security.PrivateKey privateKey = mock(PrivateKey.class); + final List chain = Arrays.asList(mock(X509Certificate.class)); + api.proceed(instance, privateKey, chain); + + verify(instance).proceed(privateKey, chain); + } + +} +*/ /** * A private key. * @@ -4750,6 +8083,87 @@ abstract class PigeonApiSslErrorHandler(open val pigeonRegistrar: AndroidWebkitL } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.SslErrorHandler; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link SslErrorHandler}. + * 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 SslErrorHandlerProxyApi extends PigeonApiSslErrorHandler { + SslErrorHandlerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @Override + public void cancel(@NonNull SslErrorHandler pigeon_instance) { + pigeon_instance.cancel(); + } + + @Override + public void proceed(@NonNull SslErrorHandler pigeon_instance) { + pigeon_instance.proceed(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.webkit.SslErrorHandler; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class SslErrorHandlerTest { + @Test + public void cancel() { + final PigeonApiSslErrorHandler api = new TestProxyApiRegistrar().getPigeonApiSslErrorHandler(); + + final SslErrorHandler instance = mock(SslErrorHandler.class); + api.cancel(instance ); + + verify(instance).cancel(); + } + + @Test + public void proceed() { + final PigeonApiSslErrorHandler api = new TestProxyApiRegistrar().getPigeonApiSslErrorHandler(); + + final SslErrorHandler instance = mock(SslErrorHandler.class); + api.proceed(instance ); + + verify(instance).proceed(); + } + +} +*/ /** * This class represents a set of one or more SSL errors and the associated SSL * certificate. @@ -4845,6 +8259,128 @@ abstract class PigeonApiSslError(open val pigeonRegistrar: AndroidWebkitLibraryP } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.net.http.SslError; +import android.net.http.SslCertificate; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link SslError}. + * 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 SslErrorProxyApi extends PigeonApiSslError { + SslErrorProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public android.net.http.SslCertificate certificate(SslError pigeon_instance) { + return pigeon_instance.getCertificate(); + } + + @NonNull + @Override + public String url(SslError pigeon_instance) { + return pigeon_instance.getUrl(); + } + + @NonNull + @Override + public SslErrorType getPrimaryError(@NonNull SslError pigeon_instance) { + return pigeon_instance.getPrimaryError(); + } + + @NonNull + @Override + public Boolean hasError(@NonNull SslError pigeon_instance,@NonNull SslErrorType error) { + return pigeon_instance.hasError(error); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.net.http.SslError; +import android.net.http.SslCertificate; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class SslErrorTest { + @Test + public void certificate() { + final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); + + final SslError instance = mock(SslError.class); + final android.net.http.SslCertificate value = mock(SslCertificate.class); + when(instance.getCertificate()).thenReturn(value); + + assertEquals(value, api.certificate(instance)); + } + + @Test + public void url() { + final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); + + final SslError instance = mock(SslError.class); + final String value = "myString"; + when(instance.getUrl()).thenReturn(value); + + assertEquals(value, api.url(instance)); + } + + @Test + public void getPrimaryError() { + final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); + + final SslError instance = mock(SslError.class); + final SslErrorType value = io.flutter.plugins.webviewflutter.SslErrorType.DATE_INVALID; + when(instance.getPrimaryError()).thenReturn(value); + + assertEquals(value, api.getPrimaryError(instance )); + } + + @Test + public void hasError() { + final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); + + final SslError instance = mock(SslError.class); + final SslErrorType error = io.flutter.plugins.webviewflutter.SslErrorType.DATE_INVALID; + final Boolean value = true; + when(instance.hasError(error)).thenReturn(value); + + assertEquals(value, api.hasError(instance, error)); + } + +} +*/ /** * A distinguished name helper class. * @@ -4973,6 +8509,125 @@ abstract class PigeonApiSslCertificateDName(open val pigeonRegistrar: AndroidWeb } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.net.http.SslCertificate.DName; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link SslCertificateDName}. + * 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 SslCertificateDNameProxyApi extends PigeonApiSslCertificateDName { + SslCertificateDNameProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public String getCName(@NonNull SslCertificateDName pigeon_instance) { + return pigeon_instance.getCName(); + } + + @NonNull + @Override + public String getDName(@NonNull SslCertificateDName pigeon_instance) { + return pigeon_instance.getDName(); + } + + @NonNull + @Override + public String getOName(@NonNull SslCertificateDName pigeon_instance) { + return pigeon_instance.getOName(); + } + + @NonNull + @Override + public String getUName(@NonNull SslCertificateDName pigeon_instance) { + return pigeon_instance.getUName(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.net.http.SslCertificate.DName; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class SslCertificateDNameTest { + @Test + public void getCName() { + final PigeonApiSslCertificateDName api = new TestProxyApiRegistrar().getPigeonApiSslCertificateDName(); + + final SslCertificateDName instance = mock(SslCertificateDName.class); + final String value = "myString"; + when(instance.getCName()).thenReturn(value); + + assertEquals(value, api.getCName(instance )); + } + + @Test + public void getDName() { + final PigeonApiSslCertificateDName api = new TestProxyApiRegistrar().getPigeonApiSslCertificateDName(); + + final SslCertificateDName instance = mock(SslCertificateDName.class); + final String value = "myString"; + when(instance.getDName()).thenReturn(value); + + assertEquals(value, api.getDName(instance )); + } + + @Test + public void getOName() { + final PigeonApiSslCertificateDName api = new TestProxyApiRegistrar().getPigeonApiSslCertificateDName(); + + final SslCertificateDName instance = mock(SslCertificateDName.class); + final String value = "myString"; + when(instance.getOName()).thenReturn(value); + + assertEquals(value, api.getOName(instance )); + } + + @Test + public void getUName() { + final PigeonApiSslCertificateDName api = new TestProxyApiRegistrar().getPigeonApiSslCertificateDName(); + + final SslCertificateDName instance = mock(SslCertificateDName.class); + final String value = "myString"; + when(instance.getUName()).thenReturn(value); + + assertEquals(value, api.getUName(instance )); + } + +} +*/ /** * SSL certificate info (certificate details) class. * @@ -5129,6 +8784,146 @@ abstract class PigeonApiSslCertificate(open val pigeonRegistrar: AndroidWebkitLi } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.net.http.SslCertificate; +import android.net.http.SslCertificate.DName; +import java.security.cert.X509Certificate; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link SslCertificate}. + * 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 SslCertificateProxyApi extends PigeonApiSslCertificate { + SslCertificateProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @Nullable + @Override + public android.net.http.SslCertificate.DName getIssuedBy(@NonNull SslCertificate pigeon_instance) { + return pigeon_instance.getIssuedBy(); + } + + @Nullable + @Override + public android.net.http.SslCertificate.DName getIssuedTo(@NonNull SslCertificate pigeon_instance) { + return pigeon_instance.getIssuedTo(); + } + + @Nullable + @Override + public Long getValidNotAfterMsSinceEpoch(@NonNull SslCertificate pigeon_instance) { + return pigeon_instance.getValidNotAfterMsSinceEpoch(); + } + + @Nullable + @Override + public Long getValidNotBeforeMsSinceEpoch(@NonNull SslCertificate pigeon_instance) { + return pigeon_instance.getValidNotBeforeMsSinceEpoch(); + } + + @Nullable + @Override + public java.security.cert.X509Certificate getX509Certificate(@NonNull SslCertificate pigeon_instance) { + return pigeon_instance.getX509Certificate(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import android.net.http.SslCertificate; +import android.net.http.SslCertificate.DName; +import java.security.cert.X509Certificate; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class SslCertificateTest { + @Test + public void getIssuedBy() { + final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); + + final SslCertificate instance = mock(SslCertificate.class); + final android.net.http.SslCertificate.DName value = mock(SslCertificateDName.class); + when(instance.getIssuedBy()).thenReturn(value); + + assertEquals(value, api.getIssuedBy(instance )); + } + + @Test + public void getIssuedTo() { + final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); + + final SslCertificate instance = mock(SslCertificate.class); + final android.net.http.SslCertificate.DName value = mock(SslCertificateDName.class); + when(instance.getIssuedTo()).thenReturn(value); + + assertEquals(value, api.getIssuedTo(instance )); + } + + @Test + public void getValidNotAfterMsSinceEpoch() { + final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); + + final SslCertificate instance = mock(SslCertificate.class); + final Long value = 0; + when(instance.getValidNotAfterMsSinceEpoch()).thenReturn(value); + + assertEquals(value, api.getValidNotAfterMsSinceEpoch(instance )); + } + + @Test + public void getValidNotBeforeMsSinceEpoch() { + final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); + + final SslCertificate instance = mock(SslCertificate.class); + final Long value = 0; + when(instance.getValidNotBeforeMsSinceEpoch()).thenReturn(value); + + assertEquals(value, api.getValidNotBeforeMsSinceEpoch(instance )); + } + + @Test + public void getX509Certificate() { + final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); + + final SslCertificate instance = mock(SslCertificate.class); + final java.security.cert.X509Certificate value = mock(X509Certificate.class); + when(instance.getX509Certificate()).thenReturn(value); + + assertEquals(value, api.getX509Certificate(instance )); + } + +} +*/ /** * Abstract class for managing a variety of identity certificates. * @@ -5194,3 +8989,71 @@ abstract class PigeonApiCertificate(open val pigeonRegistrar: AndroidWebkitLibra } } + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import java.security.cert.Certificate; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link Certificate}. + * 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 CertificateProxyApi extends PigeonApiCertificate { + CertificateProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public ByteArray getEncoded(@NonNull Certificate pigeon_instance) { + return pigeon_instance.getEncoded(); + } + +} +*/ + +/* +// 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. + +package io.flutter.plugins.webviewflutter; + +import java.security.cert.Certificate; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class CertificateTest { + @Test + public void getEncoded() { + final PigeonApiCertificate api = new TestProxyApiRegistrar().getPigeonApiCertificate(); + + final Certificate instance = mock(Certificate.class); + final ByteArray value = {0xA1}; + when(instance.getEncoded()).thenReturn(value); + + assertEquals(value, api.getEncoded(instance )); + } + +} +*/ diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ProxyApiRegistrar.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ProxyApiRegistrar.java index c4d8d556746f..671ecf425f41 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ProxyApiRegistrar.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ProxyApiRegistrar.java @@ -232,6 +232,12 @@ public PigeonApiAndroidMessage getPigeonApiAndroidMessage() { return new MessageProxyApi(this); } + @NonNull + @Override + public PigeonApiCertificate getPigeonApiCertificate() { + return new CertificateProxyApi(this); + } + @NonNull public Context getContext() { return context; diff --git a/packages/webview_flutter/webview_flutter_android/example/android/build.gradle b/packages/webview_flutter/webview_flutter_android/example/android/build.gradle index 7c1eabd81e03..a3e7dce965d2 100644 --- a/packages/webview_flutter/webview_flutter_android/example/android/build.gradle +++ b/packages/webview_flutter/webview_flutter_android/example/android/build.gradle @@ -30,7 +30,8 @@ tasks.register("clean", Delete) { gradle.projectsEvaluated { project(":webview_flutter_android") { tasks.withType(JavaCompile) { - options.compilerArgs << "-Xlint:all" << "-Werror" + // Ignore classfile due to https://issuetracker.google.com/issues/342067844 + options.compilerArgs << "-Xlint:all" << "-Werror" << "-Xlint:-classfile" } } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart index 516fba97f802..7f0f17d2116a 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart @@ -8,8 +8,7 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' - show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -20,8 +19,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -30,7 +28,6 @@ List wrapResponse( } return [error.code, error.message, error.details]; } - /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -113,10 +110,9 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> - _weakInstances = >{}; - final Map _strongInstances = - {}; + final Map> _weakInstances = + >{}; + final Map _strongInstances = {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -126,8 +122,7 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = - _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -135,67 +130,37 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.setUpMessageHandlers( - instanceManager: instanceManager); - WebResourceRequest.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebResourceResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebResourceError.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebResourceErrorCompat.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebViewPoint.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - ConsoleMessage.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - CookieManager.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebSettings.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - JavaScriptChannel.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebViewClient.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - DownloadListener.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebChromeClient.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - FlutterAssetManager.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WebStorage.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - FileChooserParams.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - PermissionRequest.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - CustomViewCallback.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + _PigeonInternalInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); + WebResourceRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebResourceResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebResourceError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebResourceErrorCompat.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebViewPoint.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + ConsoleMessage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + CookieManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebSettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + JavaScriptChannel.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebViewClient.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + DownloadListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebChromeClient.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + FlutterAssetManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WebStorage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + FileChooserParams.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + PermissionRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + CustomViewCallback.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); View.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - GeolocationPermissionsCallback.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - HttpAuthHandler.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AndroidMessage.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - ClientCertRequest.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - PrivateKey.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - X509Certificate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - SslErrorHandler.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - SslError.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - SslCertificateDName.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - SslCertificate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - Certificate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + GeolocationPermissionsCallback.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + HttpAuthHandler.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AndroidMessage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + ClientCertRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + PrivateKey.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + X509Certificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + SslErrorHandler.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + SslError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + SslCertificateDName.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + SslCertificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + Certificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); return instanceManager; } @@ -259,20 +224,15 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference( - int identifier) { - final PigeonInternalProxyApiBaseClass? weakInstance = - _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference(int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = - _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = - strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass copy = strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = - WeakReference(copy); + _weakInstances[identifier] = WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -296,20 +256,17 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = - WeakReference(instance); + _weakInstances[identifier] = WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); @@ -436,30 +393,275 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } + const _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } +} - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } +/// Handles constructing objects and calling static methods for the Android +/// Interactive Media Ads native library. +/// +/// This class provides dependency injection for the implementations of the +/// platform interface classes. Improving the ease of unit testing and/or +/// overriding the underlying Android classes. +/// +/// By default each function calls the default constructor of the class it +/// intends to return. +class AndroidWebkitGProxy { + /// Constructs an [AndroidWebkitGProxy]. + const AndroidWebkitGProxy({ + this.newWebView = WebView.new, + this.newJavaScriptChannel = JavaScriptChannel.new, + this.newWebViewClient = WebViewClient.new, + this.newDownloadListener = DownloadListener.new, + this.newWebChromeClient = WebChromeClient.new, + this.setWebContentsDebuggingEnabledWebView = + WebView.setWebContentsDebuggingEnabled, + this.instanceCookieManager = _instanceCookieManager, + this.instanceFlutterAssetManager = _instanceFlutterAssetManager, + this.instanceWebStorage = _instanceWebStorage, + }); + + /// Constructs [WebView]. + final WebView Function({ + void Function( + WebView, + int, + int, + int, + int, + )? onScrollChanged, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWebView; + + /// Constructs [JavaScriptChannel]. + final JavaScriptChannel Function({ + required void Function( + JavaScriptChannel, + String, + ) postMessage, + required String channelName, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newJavaScriptChannel; + + /// Constructs [WebViewClient]. + final WebViewClient Function({ + void Function( + WebViewClient, + WebView, + String, + )? onPageStarted, + void Function( + WebViewClient, + WebView, + String, + )? onPageFinished, + void Function( + WebViewClient, + WebView, + WebResourceRequest, + WebResourceResponse, + )? onReceivedHttpError, + void Function( + WebViewClient, + WebView, + WebResourceRequest, + WebResourceError, + )? onReceivedRequestError, + void Function( + WebViewClient, + WebView, + WebResourceRequest, + WebResourceErrorCompat, + )? onReceivedRequestErrorCompat, + void Function( + WebViewClient, + WebView, + int, + String, + String, + )? onReceivedError, + void Function( + WebViewClient, + WebView, + WebResourceRequest, + )? requestLoading, + void Function( + WebViewClient, + WebView, + String, + )? urlLoading, + void Function( + WebViewClient, + WebView, + String, + bool, + )? doUpdateVisitedHistory, + void Function( + WebViewClient, + WebView, + HttpAuthHandler, + String, + String, + )? onReceivedHttpAuthRequest, + void Function( + WebViewClient, + WebView, + AndroidMessage, + AndroidMessage, + )? onFormResubmission, + void Function( + WebViewClient, + WebView, + String, + )? onLoadResource, + void Function( + WebViewClient, + WebView, + String, + )? onPageCommitVisible, + void Function( + WebViewClient, + WebView, + ClientCertRequest, + )? onReceivedClientCertRequest, + void Function( + WebViewClient, + WebView, + String, + String?, + String, + )? onReceivedLoginRequest, + void Function( + WebViewClient, + WebView, + SslErrorHandler, + SslError, + )? onReceivedSslError, + void Function( + WebViewClient, + WebView, + double, + double, + )? onScaleChanged, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWebViewClient; + + /// Constructs [DownloadListener]. + final DownloadListener Function({ + required void Function( + DownloadListener, + String, + String, + String, + String, + int, + ) onDownloadStart, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newDownloadListener; + + /// Constructs [WebChromeClient]. + final WebChromeClient Function({ + required Future> Function( + WebChromeClient, + WebView, + FileChooserParams, + ) onShowFileChooser, + required Future Function( + WebChromeClient, + WebView, + String, + String, + ) onJsConfirm, + void Function( + WebChromeClient, + WebView, + int, + )? onProgressChanged, + void Function( + WebChromeClient, + PermissionRequest, + )? onPermissionRequest, + void Function( + WebChromeClient, + View, + CustomViewCallback, + )? onShowCustomView, + void Function(WebChromeClient)? onHideCustomView, + void Function( + WebChromeClient, + String, + GeolocationPermissionsCallback, + )? onGeolocationPermissionsShowPrompt, + void Function(WebChromeClient)? onGeolocationPermissionsHidePrompt, + void Function( + WebChromeClient, + ConsoleMessage, + )? onConsoleMessage, + Future Function( + WebChromeClient, + WebView, + String, + String, + )? onJsAlert, + Future Function( + WebChromeClient, + WebView, + String, + String, + String, + )? onJsPrompt, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWebChromeClient; + + /// Calls to [WebView.setWebContentsDebuggingEnabled]. + final Future Function( + bool, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) setWebContentsDebuggingEnabledWebView; + + /// Calls to [CookieManager.instance]. + final CookieManager Function() instanceCookieManager; + + /// Calls to [FlutterAssetManager.instance]. + final FlutterAssetManager Function() instanceFlutterAssetManager; + + /// Calls to [WebStorage.instance]. + final WebStorage Function() instanceWebStorage; + + static CookieManager _instanceCookieManager() => CookieManager.instance; + + static FlutterAssetManager _instanceFlutterAssetManager() => + FlutterAssetManager.instance; + + static WebStorage _instanceWebStorage() => WebStorage.instance; } + /// Mode of how to select files for a file chooser. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. @@ -469,17 +671,14 @@ enum FileChooserMode { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. open, - /// Similar to [open] but allows multiple files to be selected. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. openMultiple, - /// Allows picking a nonexistent file and saving it. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. save, - /// Indicates a `FileChooserMode` with an unknown mode. /// /// This does not represent an actual value provided by the platform and only @@ -495,27 +694,22 @@ enum ConsoleMessageLevel { /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG. debug, - /// Indicates a message is provided as an error. /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR. error, - /// Indicates a message is provided as a basic log message. /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG. log, - /// Indicates a message is provided as a tip. /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP. tip, - /// Indicates a message is provided as a warning. /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING. warning, - /// Indicates a message with an unknown level. /// /// This does not represent an actual value provided by the platform and only @@ -530,14 +724,11 @@ enum OverScrollMode { /// Always allow a user to over-scroll this view, provided it is a view that /// can scroll. always, - /// Allow a user to over-scroll this view only if the content is large enough /// to meaningfully scroll, provided it is a view that can scroll. ifContentScrolls, - /// Never allow a user to over-scroll this view. never, - /// The type is not recognized by this wrapper. unknown, } @@ -548,26 +739,21 @@ enum OverScrollMode { enum SslErrorType { /// The date of the certificate is invalid. dateInvalid, - /// The certificate has expired. expired, - /// Hostname mismatch. idMismatch, - /// A generic error occurred. invalid, - /// The certificate is not yet valid. notYetValid, - /// The certificate authority is not trusted. untrusted, - /// The type is not recognized by this wrapper. unknown, } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -575,16 +761,16 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is FileChooserMode) { + } else if (value is FileChooserMode) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is ConsoleMessageLevel) { + } else if (value is ConsoleMessageLevel) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is OverScrollMode) { + } else if (value is OverScrollMode) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is SslErrorType) { + } else if (value is SslErrorType) { buffer.putUint8(132); writeValue(buffer, value.index); } else { @@ -595,16 +781,16 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : FileChooserMode.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : ConsoleMessageLevel.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : OverScrollMode.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : SslErrorType.values[value]; default: @@ -612,7 +798,6 @@ class _PigeonCodec extends StandardMessageCodec { } } } - /// Encompasses parameters to the `WebViewClient.shouldInterceptRequest` method. /// /// See https://developer.android.com/reference/android/webkit/WebResourceRequest. @@ -8230,3 +8415,4 @@ class Certificate extends PigeonInternalProxyApiBaseClass { ); } } + diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 21e45198c78e..77b27db1e573 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -27,7 +27,11 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^25.3.0 + pigeon: + git: + url: git@github.com:bparrishMines/packages.git + ref: pigeon_helper + path: packages/pigeon topics: - html From c2aa4a488d0d750641189ffb1f45369b696c529b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 23 Apr 2025 03:20:26 -0400 Subject: [PATCH 06/34] add certificate impl --- .../webviewflutter/CertificateProxyApi.java | 34 +++++++++++++++++++ .../webviewflutter/CertificateTest.java | 34 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CertificateProxyApi.java create mode 100644 packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CertificateTest.java diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CertificateProxyApi.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CertificateProxyApi.java new file mode 100644 index 000000000000..995c8e6df516 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CertificateProxyApi.java @@ -0,0 +1,34 @@ +// 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. + +package io.flutter.plugins.webviewflutter; + +import java.security.cert.Certificate; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import java.security.cert.CertificateEncodingException; +import java.util.List; +import java.util.Map; + +/** + * ProxyApi implementation for {@link Certificate}. + * 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 CertificateProxyApi extends PigeonApiCertificate { + CertificateProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { + super(pigeonRegistrar); + } + + @NonNull + @Override + public byte[] getEncoded(@NonNull Certificate pigeon_instance) { + try { + return pigeon_instance.getEncoded(); + } catch (CertificateEncodingException exception) { + throw new RuntimeException(exception); + } + } +} diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CertificateTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CertificateTest.java new file mode 100644 index 000000000000..61206eb03a2d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CertificateTest.java @@ -0,0 +1,34 @@ +// 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. + +package io.flutter.plugins.webviewflutter; + +import java.security.cert.Certificate; +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import org.mockito.Mockito; +import static org.mockito.Mockito.any; + +import java.security.cert.CertificateEncodingException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +public class CertificateTest { + @Test + public void getEncoded() throws CertificateEncodingException { + final PigeonApiCertificate api = new TestProxyApiRegistrar().getPigeonApiCertificate(); + + final Certificate instance = mock(Certificate.class); + final byte[] value = new byte[] {(byte) 0xA1}; + when(instance.getEncoded()).thenReturn(value); + + assertEquals(value, api.getEncoded(instance)); + } +} From f952665434bb718ab8fe98f20a50b57a26361549 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:51:39 -0400 Subject: [PATCH 07/34] update pigeon --- .../webviewflutter/AndroidWebkitLibrary.g.kt | 8007 ++++++----------- .../webviewflutter/CertificateProxyApi.java | 12 +- .../webviewflutter/CertificateTest.java | 16 +- .../lib/src/android_webkit.g.dart | 454 +- .../webview_flutter_android/pubspec.yaml | 6 +- 5 files changed, 2710 insertions(+), 5785 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt index 4746c0dd994b..4a8d7a1cefed 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt @@ -10,16 +10,17 @@ package io.flutter.plugins.webviewflutter import android.util.Log import io.flutter.plugin.common.BasicMessageChannel import io.flutter.plugin.common.BinaryMessenger -import io.flutter.plugin.common.EventChannel import io.flutter.plugin.common.MessageCodec -import io.flutter.plugin.common.StandardMethodCodec import io.flutter.plugin.common.StandardMessageCodec import java.io.ByteArrayOutputStream import java.nio.ByteBuffer + private object AndroidWebkitLibraryPigeonUtils { fun createConnectionError(channelName: String): AndroidWebKitError { - return AndroidWebKitError("channel-error", "Unable to establish connection on channel: '$channelName'.", "") } + return AndroidWebKitError( + "channel-error", "Unable to establish connection on channel: '$channelName'.", "") + } fun wrapResult(result: Any?): List { return listOf(result) @@ -27,50 +28,48 @@ private object AndroidWebkitLibraryPigeonUtils { fun wrapError(exception: Throwable): List { return if (exception is AndroidWebKitError) { - listOf( - exception.code, - exception.message, - exception.details - ) + listOf(exception.code, exception.message, exception.details) } else { listOf( - exception.javaClass.simpleName, - exception.toString(), - "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception) - ) + exception.javaClass.simpleName, + exception.toString(), + "Cause: " + exception.cause + ", Stacktrace: " + Log.getStackTraceString(exception)) } } } /** * Error class for passing custom error details to Flutter via a thrown PlatformException. + * * @property code The error code. * @property message The error message. * @property details The error details. Must be a datatype supported by the api codec. */ -class AndroidWebKitError ( - val code: String, - override val message: String? = null, - val details: Any? = null +class AndroidWebKitError( + val code: String, + override val message: String? = null, + val details: Any? = null ) : Throwable() /** * Maintains instances used to communicate with the corresponding objects in Dart. * - * Objects stored in this container are represented by an object in Dart that is also stored in - * an InstanceManager with the same identifier. + * Objects stored in this container are represented by an object in Dart that is also stored in an + * InstanceManager with the same identifier. * * When an instance is added with an identifier, either can be used to retrieve the other. * - * Added instances are added as a weak reference and a strong reference. When the strong - * reference is removed with [remove] and the weak reference is deallocated, the - * `finalizationListener.onFinalize` is called with the instance's identifier. However, if the strong - * reference is removed and then the identifier is retrieved with the intention to pass the identifier - * to Dart (e.g. calling [getIdentifierForStrongReference]), the strong reference to the instance - * is recreated. The strong reference will then need to be removed manually again. + * Added instances are added as a weak reference and a strong reference. When the strong reference + * is removed with [remove] and the weak reference is deallocated, the + * `finalizationListener.onFinalize` is called with the instance's identifier. However, if the + * strong reference is removed and then the identifier is retrieved with the intention to pass the + * identifier to Dart (e.g. calling [getIdentifierForStrongReference]), the strong reference to the + * instance is recreated. The strong reference will then need to be removed manually again. */ @Suppress("UNCHECKED_CAST", "MemberVisibilityCanBePrivate") -class AndroidWebkitLibraryPigeonInstanceManager(private val finalizationListener: PigeonFinalizationListener) { - /** Interface for listening when a weak reference of an instance is removed from the manager. */ +class AndroidWebkitLibraryPigeonInstanceManager( + private val finalizationListener: PigeonFinalizationListener +) { + /** Interface for listening when a weak reference of an instance is removed from the manager. */ interface PigeonFinalizationListener { fun onFinalize(identifier: Long) } @@ -111,37 +110,40 @@ class AndroidWebkitLibraryPigeonInstanceManager(private val finalizationListener private const val tag = "PigeonInstanceManager" /** - * Instantiate a new manager with a listener for garbage collected weak - * references. + * Instantiate a new manager with a listener for garbage collected weak references. * * When the manager is no longer needed, [stopFinalizationListener] must be called. */ - fun create(finalizationListener: PigeonFinalizationListener): AndroidWebkitLibraryPigeonInstanceManager { + fun create( + finalizationListener: PigeonFinalizationListener + ): AndroidWebkitLibraryPigeonInstanceManager { return AndroidWebkitLibraryPigeonInstanceManager(finalizationListener) } } /** - * Removes `identifier` and return its associated strongly referenced instance, if present, - * from the manager. + * Removes `identifier` and return its associated strongly referenced instance, if present, from + * the manager. */ fun remove(identifier: Long): T? { logWarningIfFinalizationListenerHasStopped() + val instance: Any? = getInstance(identifier) + if (instance is WebViewProxyApi.WebViewPlatformView) { + instance.destroy() + } return strongInstances.remove(identifier) as T? } /** * Retrieves the identifier paired with an instance, if present, otherwise `null`. * - * * If the manager contains a strong reference to `instance`, it will return the identifier * associated with `instance`. If the manager contains only a weak reference to `instance`, a new * strong reference to `instance` will be added and will need to be removed again with [remove]. * - * * If this method returns a nonnull identifier, this method also expects the Dart - * `AndroidWebkitLibraryPigeonInstanceManager` to have, or recreate, a weak reference to the Dart instance the - * identifier is associated with. + * `AndroidWebkitLibraryPigeonInstanceManager` to have, or recreate, a weak reference to the Dart + * instance the identifier is associated with. */ fun getIdentifierForStrongReference(instance: Any?): Long? { logWarningIfFinalizationListenerHasStopped() @@ -155,9 +157,9 @@ class AndroidWebkitLibraryPigeonInstanceManager(private val finalizationListener /** * Adds a new instance that was instantiated from Dart. * - * The same instance can be added multiple times, but each identifier must be unique. This - * allows two objects that are equivalent (e.g. the `equals` method returns true and their - * hashcodes are equal) to both be added. + * The same instance can be added multiple times, but each identifier must be unique. This allows + * two objects that are equivalent (e.g. the `equals` method returns true and their hashcodes are + * equal) to both be added. * * [identifier] must be >= 0 and unique. */ @@ -169,13 +171,15 @@ class AndroidWebkitLibraryPigeonInstanceManager(private val finalizationListener /** * Adds a new unique instance that was instantiated from the host platform. * - * If the manager contains [instance], this returns the corresponding identifier. If the - * manager does not contain [instance], this adds the instance and returns a unique - * identifier for that [instance]. + * If the manager contains [instance], this returns the corresponding identifier. If the manager + * does not contain [instance], this adds the instance and returns a unique identifier for that + * [instance]. */ fun addHostCreatedInstance(instance: Any): Long { logWarningIfFinalizationListenerHasStopped() - require(!containsInstance(instance)) { "Instance of ${instance.javaClass} has already been added." } + require(!containsInstance(instance)) { + "Instance of ${instance.javaClass} has already been added." + } val identifier = nextIdentifier++ addInstance(instance, identifier) return identifier @@ -233,7 +237,8 @@ class AndroidWebkitLibraryPigeonInstanceManager(private val finalizationListener return } var reference: java.lang.ref.WeakReference? - while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } != null) { + while ((referenceQueue.poll() as java.lang.ref.WeakReference?).also { reference = it } != + null) { val identifier = weakReferencesToIdentifiers.remove(reference) if (identifier != null) { weakInstances.remove(identifier) @@ -259,39 +264,43 @@ class AndroidWebkitLibraryPigeonInstanceManager(private val finalizationListener private fun logWarningIfFinalizationListenerHasStopped() { if (hasFinalizationListenerStopped()) { Log.w( - tag, - "The manager was used after calls to the PigeonFinalizationListener has been stopped." - ) + tag, + "The manager was used after calls to the PigeonFinalizationListener has been stopped.") } } } - /** Generated API for managing the Dart and native `InstanceManager`s. */ private class AndroidWebkitLibraryPigeonInstanceManagerApi(val binaryMessenger: BinaryMessenger) { companion object { /** The codec used by AndroidWebkitLibraryPigeonInstanceManagerApi. */ - val codec: MessageCodec by lazy { - AndroidWebkitLibraryPigeonCodec() - } + val codec: MessageCodec by lazy { AndroidWebkitLibraryPigeonCodec() } /** - * Sets up an instance of `AndroidWebkitLibraryPigeonInstanceManagerApi` to handle messages from the - * `binaryMessenger`. + * Sets up an instance of `AndroidWebkitLibraryPigeonInstanceManagerApi` to handle messages from + * the `binaryMessenger`. */ - fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, instanceManager: AndroidWebkitLibraryPigeonInstanceManager?) { + fun setUpMessageHandlers( + binaryMessenger: BinaryMessenger, + instanceManager: AndroidWebkitLibraryPigeonInstanceManager? + ) { run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.removeStrongReference", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.removeStrongReference", + codec) if (instanceManager != null) { channel.setMessageHandler { message, reply -> val args = message as List val identifierArg = args[0] as Long - val wrapped: List = try { - instanceManager.remove(identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + instanceManager.remove(identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -299,15 +308,20 @@ private class AndroidWebkitLibraryPigeonInstanceManagerApi(val binaryMessenger: } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.clear", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.clear", + codec) if (instanceManager != null) { channel.setMessageHandler { _, reply -> - val wrapped: List = try { - instanceManager.clear() - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + instanceManager.clear() + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -317,26 +331,28 @@ private class AndroidWebkitLibraryPigeonInstanceManagerApi(val binaryMessenger: } } - fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) -{ - val channelName = "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.removeStrongReference" + fun removeStrongReference(identifierArg: Long, callback: (Result) -> Unit) { + val channelName = + "dev.flutter.pigeon.webview_flutter_android.PigeonInternalInstanceManager.removeStrongReference" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } } /** - * Provides implementations for each ProxyApi implementation and provides access to resources - * needed by any implementation. + * Provides implementations for each ProxyApi implementation and provides access to resources needed + * by any implementation. */ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: BinaryMessenger) { /** Whether APIs should ignore calling to Dart. */ @@ -353,20 +369,19 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: init { val api = AndroidWebkitLibraryPigeonInstanceManagerApi(binaryMessenger) - instanceManager = AndroidWebkitLibraryPigeonInstanceManager.create( - object : AndroidWebkitLibraryPigeonInstanceManager.PigeonFinalizationListener { - override fun onFinalize(identifier: Long) { - api.removeStrongReference(identifier) { - if (it.isFailure) { - Log.e( - "PigeonProxyApiRegistrar", - "Failed to remove Dart strong reference with identifier: $identifier" - ) - } - } - } - } - ) + instanceManager = + AndroidWebkitLibraryPigeonInstanceManager.create( + object : AndroidWebkitLibraryPigeonInstanceManager.PigeonFinalizationListener { + override fun onFinalize(identifier: Long) { + api.removeStrongReference(identifier) { + if (it.isFailure) { + Log.e( + "PigeonProxyApiRegistrar", + "Failed to remove Dart strong reference with identifier: $identifier") + } + } + } + }) } /** * An implementation of [PigeonApiWebResourceRequest] used to add a new Dart instance of @@ -393,8 +408,8 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiWebResourceErrorCompat(): PigeonApiWebResourceErrorCompat /** - * An implementation of [PigeonApiWebViewPoint] used to add a new Dart instance of - * `WebViewPoint` to the Dart `InstanceManager`. + * An implementation of [PigeonApiWebViewPoint] used to add a new Dart instance of `WebViewPoint` + * to the Dart `InstanceManager`. */ abstract fun getPigeonApiWebViewPoint(): PigeonApiWebViewPoint @@ -411,14 +426,14 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiCookieManager(): PigeonApiCookieManager /** - * An implementation of [PigeonApiWebView] used to add a new Dart instance of - * `WebView` to the Dart `InstanceManager`. + * An implementation of [PigeonApiWebView] used to add a new Dart instance of `WebView` to the + * Dart `InstanceManager`. */ abstract fun getPigeonApiWebView(): PigeonApiWebView /** - * An implementation of [PigeonApiWebSettings] used to add a new Dart instance of - * `WebSettings` to the Dart `InstanceManager`. + * An implementation of [PigeonApiWebSettings] used to add a new Dart instance of `WebSettings` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiWebSettings(): PigeonApiWebSettings @@ -453,8 +468,8 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiFlutterAssetManager(): PigeonApiFlutterAssetManager /** - * An implementation of [PigeonApiWebStorage] used to add a new Dart instance of - * `WebStorage` to the Dart `InstanceManager`. + * An implementation of [PigeonApiWebStorage] used to add a new Dart instance of `WebStorage` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiWebStorage(): PigeonApiWebStorage @@ -477,14 +492,14 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiCustomViewCallback(): PigeonApiCustomViewCallback /** - * An implementation of [PigeonApiView] used to add a new Dart instance of - * `View` to the Dart `InstanceManager`. + * An implementation of [PigeonApiView] used to add a new Dart instance of `View` to the Dart + * `InstanceManager`. */ abstract fun getPigeonApiView(): PigeonApiView /** - * An implementation of [PigeonApiGeolocationPermissionsCallback] used to add a new Dart instance of - * `GeolocationPermissionsCallback` to the Dart `InstanceManager`. + * An implementation of [PigeonApiGeolocationPermissionsCallback] used to add a new Dart instance + * of `GeolocationPermissionsCallback` to the Dart `InstanceManager`. */ abstract fun getPigeonApiGeolocationPermissionsCallback(): PigeonApiGeolocationPermissionsCallback @@ -507,11 +522,10 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiClientCertRequest(): PigeonApiClientCertRequest /** - * An implementation of [PigeonApiPrivateKey] used to add a new Dart instance of - * `PrivateKey` to the Dart `InstanceManager`. + * An implementation of [PigeonApiPrivateKey] used to add a new Dart instance of `PrivateKey` to + * the Dart `InstanceManager`. */ - open fun getPigeonApiPrivateKey(): PigeonApiPrivateKey - { + open fun getPigeonApiPrivateKey(): PigeonApiPrivateKey { return PigeonApiPrivateKey(this) } @@ -519,8 +533,7 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: * An implementation of [PigeonApiX509Certificate] used to add a new Dart instance of * `X509Certificate` to the Dart `InstanceManager`. */ - open fun getPigeonApiX509Certificate(): PigeonApiX509Certificate - { + open fun getPigeonApiX509Certificate(): PigeonApiX509Certificate { return PigeonApiX509Certificate(this) } @@ -531,8 +544,8 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiSslErrorHandler(): PigeonApiSslErrorHandler /** - * An implementation of [PigeonApiSslError] used to add a new Dart instance of - * `SslError` to the Dart `InstanceManager`. + * An implementation of [PigeonApiSslError] used to add a new Dart instance of `SslError` to the + * Dart `InstanceManager`. */ abstract fun getPigeonApiSslError(): PigeonApiSslError @@ -549,35 +562,44 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: abstract fun getPigeonApiSslCertificate(): PigeonApiSslCertificate /** - * An implementation of [PigeonApiCertificate] used to add a new Dart instance of - * `Certificate` to the Dart `InstanceManager`. + * An implementation of [PigeonApiCertificate] used to add a new Dart instance of `Certificate` to + * the Dart `InstanceManager`. */ abstract fun getPigeonApiCertificate(): PigeonApiCertificate fun setUp() { - AndroidWebkitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, instanceManager) + AndroidWebkitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger, instanceManager) PigeonApiCookieManager.setUpMessageHandlers(binaryMessenger, getPigeonApiCookieManager()) PigeonApiWebView.setUpMessageHandlers(binaryMessenger, getPigeonApiWebView()) PigeonApiWebSettings.setUpMessageHandlers(binaryMessenger, getPigeonApiWebSettings()) - PigeonApiJavaScriptChannel.setUpMessageHandlers(binaryMessenger, getPigeonApiJavaScriptChannel()) + PigeonApiJavaScriptChannel.setUpMessageHandlers( + binaryMessenger, getPigeonApiJavaScriptChannel()) PigeonApiWebViewClient.setUpMessageHandlers(binaryMessenger, getPigeonApiWebViewClient()) PigeonApiDownloadListener.setUpMessageHandlers(binaryMessenger, getPigeonApiDownloadListener()) PigeonApiWebChromeClient.setUpMessageHandlers(binaryMessenger, getPigeonApiWebChromeClient()) - PigeonApiFlutterAssetManager.setUpMessageHandlers(binaryMessenger, getPigeonApiFlutterAssetManager()) + PigeonApiFlutterAssetManager.setUpMessageHandlers( + binaryMessenger, getPigeonApiFlutterAssetManager()) PigeonApiWebStorage.setUpMessageHandlers(binaryMessenger, getPigeonApiWebStorage()) - PigeonApiPermissionRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiPermissionRequest()) - PigeonApiCustomViewCallback.setUpMessageHandlers(binaryMessenger, getPigeonApiCustomViewCallback()) + PigeonApiPermissionRequest.setUpMessageHandlers( + binaryMessenger, getPigeonApiPermissionRequest()) + PigeonApiCustomViewCallback.setUpMessageHandlers( + binaryMessenger, getPigeonApiCustomViewCallback()) PigeonApiView.setUpMessageHandlers(binaryMessenger, getPigeonApiView()) - PigeonApiGeolocationPermissionsCallback.setUpMessageHandlers(binaryMessenger, getPigeonApiGeolocationPermissionsCallback()) + PigeonApiGeolocationPermissionsCallback.setUpMessageHandlers( + binaryMessenger, getPigeonApiGeolocationPermissionsCallback()) PigeonApiHttpAuthHandler.setUpMessageHandlers(binaryMessenger, getPigeonApiHttpAuthHandler()) PigeonApiAndroidMessage.setUpMessageHandlers(binaryMessenger, getPigeonApiAndroidMessage()) - PigeonApiClientCertRequest.setUpMessageHandlers(binaryMessenger, getPigeonApiClientCertRequest()) + PigeonApiClientCertRequest.setUpMessageHandlers( + binaryMessenger, getPigeonApiClientCertRequest()) PigeonApiSslErrorHandler.setUpMessageHandlers(binaryMessenger, getPigeonApiSslErrorHandler()) PigeonApiSslError.setUpMessageHandlers(binaryMessenger, getPigeonApiSslError()) - PigeonApiSslCertificateDName.setUpMessageHandlers(binaryMessenger, getPigeonApiSslCertificateDName()) + PigeonApiSslCertificateDName.setUpMessageHandlers( + binaryMessenger, getPigeonApiSslCertificateDName()) PigeonApiSslCertificate.setUpMessageHandlers(binaryMessenger, getPigeonApiSslCertificate()) PigeonApiCertificate.setUpMessageHandlers(binaryMessenger, getPigeonApiCertificate()) } + fun tearDown() { AndroidWebkitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger, null) PigeonApiCookieManager.setUpMessageHandlers(binaryMessenger, null) @@ -603,17 +625,17 @@ abstract class AndroidWebkitLibraryPigeonProxyApiRegistrar(val binaryMessenger: PigeonApiCertificate.setUpMessageHandlers(binaryMessenger, null) } } -private class AndroidWebkitLibraryPigeonProxyApiBaseCodec(val registrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) : AndroidWebkitLibraryPigeonCodec() { + +private class AndroidWebkitLibraryPigeonProxyApiBaseCodec( + val registrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) : AndroidWebkitLibraryPigeonCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 128.toByte() -> { val identifier: Long = readValue(buffer) as Long val instance: Any? = registrar.instanceManager.getInstance(identifier) if (instance == null) { - Log.e( - "PigeonProxyApiBaseCodec", - "Failed to find instance with identifier: $identifier" - ) + Log.e("PigeonProxyApiBaseCodec", "Failed to find instance with identifier: $identifier") } return instance } @@ -622,100 +644,88 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec(val registrar: Android } override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { - if (value is Boolean || value is ByteArray || value is Double || value is DoubleArray || value is FloatArray || value is Int || value is IntArray || value is List<*> || value is Long || value is LongArray || value is Map<*, *> || value is String || value is FileChooserMode || value is ConsoleMessageLevel || value is OverScrollMode || value is SslErrorType || value == null) { + if (value is Boolean || + value is ByteArray || + value is Double || + value is DoubleArray || + value is FloatArray || + value is Int || + value is IntArray || + value is List<*> || + value is Long || + value is LongArray || + value is Map<*, *> || + value is String || + value is FileChooserMode || + value is ConsoleMessageLevel || + value is OverScrollMode || + value is SslErrorType || + value == null) { super.writeValue(stream, value) return } if (value is android.webkit.WebResourceRequest) { - registrar.getPigeonApiWebResourceRequest().pigeon_newInstance(value) { } - } - else if (value is android.webkit.WebResourceResponse) { - registrar.getPigeonApiWebResourceResponse().pigeon_newInstance(value) { } - } - else if (android.os.Build.VERSION.SDK_INT >= 23 && value is android.webkit.WebResourceError) { - registrar.getPigeonApiWebResourceError().pigeon_newInstance(value) { } - } - else if (value is androidx.webkit.WebResourceErrorCompat) { - registrar.getPigeonApiWebResourceErrorCompat().pigeon_newInstance(value) { } - } - else if (value is WebViewPoint) { - registrar.getPigeonApiWebViewPoint().pigeon_newInstance(value) { } - } - else if (value is android.webkit.ConsoleMessage) { - registrar.getPigeonApiConsoleMessage().pigeon_newInstance(value) { } - } - else if (value is android.webkit.CookieManager) { - registrar.getPigeonApiCookieManager().pigeon_newInstance(value) { } - } - else if (value is android.webkit.WebView) { - registrar.getPigeonApiWebView().pigeon_newInstance(value) { } - } - else if (value is android.webkit.WebSettings) { - registrar.getPigeonApiWebSettings().pigeon_newInstance(value) { } - } - else if (value is JavaScriptChannel) { - registrar.getPigeonApiJavaScriptChannel().pigeon_newInstance(value) { } - } - else if (value is android.webkit.WebViewClient) { - registrar.getPigeonApiWebViewClient().pigeon_newInstance(value) { } - } - else if (value is android.webkit.DownloadListener) { - registrar.getPigeonApiDownloadListener().pigeon_newInstance(value) { } - } - else if (value is io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl) { - registrar.getPigeonApiWebChromeClient().pigeon_newInstance(value) { } - } - else if (value is io.flutter.plugins.webviewflutter.FlutterAssetManager) { - registrar.getPigeonApiFlutterAssetManager().pigeon_newInstance(value) { } - } - else if (value is android.webkit.WebStorage) { - registrar.getPigeonApiWebStorage().pigeon_newInstance(value) { } - } - else if (value is android.webkit.WebChromeClient.FileChooserParams) { - registrar.getPigeonApiFileChooserParams().pigeon_newInstance(value) { } - } - else if (value is android.webkit.PermissionRequest) { - registrar.getPigeonApiPermissionRequest().pigeon_newInstance(value) { } - } - else if (value is android.webkit.WebChromeClient.CustomViewCallback) { - registrar.getPigeonApiCustomViewCallback().pigeon_newInstance(value) { } - } - else if (value is android.view.View) { - registrar.getPigeonApiView().pigeon_newInstance(value) { } - } - else if (value is android.webkit.GeolocationPermissions.Callback) { - registrar.getPigeonApiGeolocationPermissionsCallback().pigeon_newInstance(value) { } - } - else if (value is android.webkit.HttpAuthHandler) { - registrar.getPigeonApiHttpAuthHandler().pigeon_newInstance(value) { } - } - else if (value is android.os.Message) { - registrar.getPigeonApiAndroidMessage().pigeon_newInstance(value) { } - } - else if (value is android.webkit.ClientCertRequest) { - registrar.getPigeonApiClientCertRequest().pigeon_newInstance(value) { } - } - else if (value is java.security.PrivateKey) { - registrar.getPigeonApiPrivateKey().pigeon_newInstance(value) { } - } - else if (value is java.security.cert.X509Certificate) { - registrar.getPigeonApiX509Certificate().pigeon_newInstance(value) { } - } - else if (value is android.webkit.SslErrorHandler) { - registrar.getPigeonApiSslErrorHandler().pigeon_newInstance(value) { } - } - else if (value is android.net.http.SslError) { - registrar.getPigeonApiSslError().pigeon_newInstance(value) { } - } - else if (value is android.net.http.SslCertificate.DName) { - registrar.getPigeonApiSslCertificateDName().pigeon_newInstance(value) { } - } - else if (value is android.net.http.SslCertificate) { - registrar.getPigeonApiSslCertificate().pigeon_newInstance(value) { } - } - else if (value is java.security.cert.Certificate) { - registrar.getPigeonApiCertificate().pigeon_newInstance(value) { } + registrar.getPigeonApiWebResourceRequest().pigeon_newInstance(value) {} + } else if (value is android.webkit.WebResourceResponse) { + registrar.getPigeonApiWebResourceResponse().pigeon_newInstance(value) {} + } else if (android.os.Build.VERSION.SDK_INT >= 23 && value is android.webkit.WebResourceError) { + registrar.getPigeonApiWebResourceError().pigeon_newInstance(value) {} + } else if (value is androidx.webkit.WebResourceErrorCompat) { + registrar.getPigeonApiWebResourceErrorCompat().pigeon_newInstance(value) {} + } else if (value is WebViewPoint) { + registrar.getPigeonApiWebViewPoint().pigeon_newInstance(value) {} + } else if (value is android.webkit.ConsoleMessage) { + registrar.getPigeonApiConsoleMessage().pigeon_newInstance(value) {} + } else if (value is android.webkit.CookieManager) { + registrar.getPigeonApiCookieManager().pigeon_newInstance(value) {} + } else if (value is android.webkit.WebView) { + registrar.getPigeonApiWebView().pigeon_newInstance(value) {} + } else if (value is android.webkit.WebSettings) { + registrar.getPigeonApiWebSettings().pigeon_newInstance(value) {} + } else if (value is JavaScriptChannel) { + registrar.getPigeonApiJavaScriptChannel().pigeon_newInstance(value) {} + } else if (value is android.webkit.WebViewClient) { + registrar.getPigeonApiWebViewClient().pigeon_newInstance(value) {} + } else if (value is android.webkit.DownloadListener) { + registrar.getPigeonApiDownloadListener().pigeon_newInstance(value) {} + } else if (value + is io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl) { + registrar.getPigeonApiWebChromeClient().pigeon_newInstance(value) {} + } else if (value is io.flutter.plugins.webviewflutter.FlutterAssetManager) { + registrar.getPigeonApiFlutterAssetManager().pigeon_newInstance(value) {} + } else if (value is android.webkit.WebStorage) { + registrar.getPigeonApiWebStorage().pigeon_newInstance(value) {} + } else if (value is android.webkit.WebChromeClient.FileChooserParams) { + registrar.getPigeonApiFileChooserParams().pigeon_newInstance(value) {} + } else if (value is android.webkit.PermissionRequest) { + registrar.getPigeonApiPermissionRequest().pigeon_newInstance(value) {} + } else if (value is android.webkit.WebChromeClient.CustomViewCallback) { + registrar.getPigeonApiCustomViewCallback().pigeon_newInstance(value) {} + } else if (value is android.view.View) { + registrar.getPigeonApiView().pigeon_newInstance(value) {} + } else if (value is android.webkit.GeolocationPermissions.Callback) { + registrar.getPigeonApiGeolocationPermissionsCallback().pigeon_newInstance(value) {} + } else if (value is android.webkit.HttpAuthHandler) { + registrar.getPigeonApiHttpAuthHandler().pigeon_newInstance(value) {} + } else if (value is android.os.Message) { + registrar.getPigeonApiAndroidMessage().pigeon_newInstance(value) {} + } else if (value is android.webkit.ClientCertRequest) { + registrar.getPigeonApiClientCertRequest().pigeon_newInstance(value) {} + } else if (value is java.security.PrivateKey) { + registrar.getPigeonApiPrivateKey().pigeon_newInstance(value) {} + } else if (value is java.security.cert.X509Certificate) { + registrar.getPigeonApiX509Certificate().pigeon_newInstance(value) {} + } else if (value is android.webkit.SslErrorHandler) { + registrar.getPigeonApiSslErrorHandler().pigeon_newInstance(value) {} + } else if (value is android.net.http.SslError) { + registrar.getPigeonApiSslError().pigeon_newInstance(value) {} + } else if (value is android.net.http.SslCertificate.DName) { + registrar.getPigeonApiSslCertificateDName().pigeon_newInstance(value) {} + } else if (value is android.net.http.SslCertificate) { + registrar.getPigeonApiSslCertificate().pigeon_newInstance(value) {} + } else if (value is java.security.cert.Certificate) { + registrar.getPigeonApiCertificate().pigeon_newInstance(value) {} } when { @@ -723,7 +733,9 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec(val registrar: Android stream.write(128) writeValue(stream, registrar.instanceManager.getIdentifierForStrongReference(value)) } - else -> throw IllegalArgumentException("Unsupported value: '$value' of type '${value.javaClass.name}'") + else -> + throw IllegalArgumentException( + "Unsupported value: '$value' of type '${value.javaClass.name}'") } } } @@ -735,29 +747,31 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec(val registrar: Android */ enum class FileChooserMode(val raw: Int) { /** - * Open single file and requires that the file exists before allowing the - * user to pick it. + * Open single file and requires that the file exists before allowing the user to pick it. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. + * See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. */ OPEN(0), /** * Similar to [open] but allows multiple files to be selected. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. + * See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. */ OPEN_MULTIPLE(1), /** * Allows picking a nonexistent file and saving it. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. + * See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. */ SAVE(2), /** * Indicates a `FileChooserMode` with an unknown mode. * - * This does not represent an actual value provided by the platform and only - * indicates a value was provided that isn't currently supported. + * This does not represent an actual value provided by the platform and only indicates a value was + * provided that isn't currently supported. */ UNKNOWN(3); @@ -807,8 +821,8 @@ enum class ConsoleMessageLevel(val raw: Int) { /** * Indicates a message with an unknown level. * - * This does not represent an actual value provided by the platform and only - * indicates a value was provided that isn't currently supported. + * This does not represent an actual value provided by the platform and only indicates a value was + * provided that isn't currently supported. */ UNKNOWN(5); @@ -825,14 +839,11 @@ enum class ConsoleMessageLevel(val raw: Int) { * See https://developer.android.com/reference/android/view/View#OVER_SCROLL_ALWAYS. */ enum class OverScrollMode(val raw: Int) { - /** - * Always allow a user to over-scroll this view, provided it is a view that - * can scroll. - */ + /** Always allow a user to over-scroll this view, provided it is a view that can scroll. */ ALWAYS(0), /** - * Allow a user to over-scroll this view only if the content is large enough - * to meaningfully scroll, provided it is a view that can scroll. + * Allow a user to over-scroll this view only if the content is large enough to meaningfully + * scroll, provided it is a view that can scroll. */ IF_CONTENT_SCROLLS(1), /** Never allow a user to over-scroll this view. */ @@ -874,33 +885,27 @@ enum class SslErrorType(val raw: Int) { } } } + private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { 129.toByte() -> { - return (readValue(buffer) as Long?)?.let { - FileChooserMode.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { FileChooserMode.ofRaw(it.toInt()) } } 130.toByte() -> { - return (readValue(buffer) as Long?)?.let { - ConsoleMessageLevel.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { ConsoleMessageLevel.ofRaw(it.toInt()) } } 131.toByte() -> { - return (readValue(buffer) as Long?)?.let { - OverScrollMode.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { OverScrollMode.ofRaw(it.toInt()) } } 132.toByte() -> { - return (readValue(buffer) as Long?)?.let { - SslErrorType.ofRaw(it.toInt()) - } + return (readValue(buffer) as Long?)?.let { SslErrorType.ofRaw(it.toInt()) } } else -> super.readValueOfType(type, buffer) } } - override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { + + override fun writeValue(stream: ByteArrayOutputStream, value: Any?) { when (value) { is FileChooserMode -> { stream.write(129) @@ -929,7 +934,9 @@ private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { * See https://developer.android.com/reference/android/webkit/WebResourceRequest. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebResourceRequest(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiWebResourceRequest( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** The URL for which the resource request was made. */ abstract fun url(pigeon_instance: android.webkit.WebResourceRequest): String @@ -946,20 +953,25 @@ abstract class PigeonApiWebResourceRequest(open val pigeonRegistrar: AndroidWebk abstract fun method(pigeon_instance: android.webkit.WebResourceRequest): String /** The headers associated with the request. */ - abstract fun requestHeaders(pigeon_instance: android.webkit.WebResourceRequest): Map? + abstract fun requestHeaders( + pigeon_instance: android.webkit.WebResourceRequest + ): Map? @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebResourceRequest and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebResourceRequest, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebResourceRequest, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val urlArg = url(pigeon_instanceArg) val isForMainFrameArg = isForMainFrame(pigeon_instanceArg) val isRedirectArg = isRedirect(pigeon_instanceArg) @@ -968,294 +980,94 @@ abstract class PigeonApiWebResourceRequest(open val pigeonRegistrar: AndroidWebk val requestHeadersArg = requestHeaders(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebResourceRequest.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebResourceRequest.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_identifierArg, urlArg, isForMainFrameArg, isRedirectArg, hasGestureArg, methodArg, requestHeadersArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) + channel.send( + listOf( + pigeon_identifierArg, + urlArg, + isForMainFrameArg, + isRedirectArg, + hasGestureArg, + methodArg, + requestHeadersArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback( + Result.failure( + AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } - } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebResourceRequest; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebResourceRequest}. - * 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 WebResourceRequestProxyApi extends PigeonApiWebResourceRequest { - WebResourceRequestProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public String url(WebResourceRequest pigeon_instance) { - return pigeon_instance.getUrl(); - } - - @NonNull - @Override - public Boolean isForMainFrame(WebResourceRequest pigeon_instance) { - return pigeon_instance.getIsForMainFrame(); - } - - @Nullable - @Override - public Boolean? isRedirect(WebResourceRequest pigeon_instance) { - return pigeon_instance.getIsRedirect(); - } - - @NonNull - @Override - public Boolean hasGesture(WebResourceRequest pigeon_instance) { - return pigeon_instance.getHasGesture(); - } - - @NonNull - @Override - public String method(WebResourceRequest pigeon_instance) { - return pigeon_instance.getMethod(); - } - - @Nullable - @Override - public Map? requestHeaders(WebResourceRequest pigeon_instance) { - return pigeon_instance.getRequestHeaders(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebResourceRequest; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebResourceRequestTest { - @Test - public void url() { - final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); - - final WebResourceRequest instance = mock(WebResourceRequest.class); - final String value = "myString"; - when(instance.getUrl()).thenReturn(value); - - assertEquals(value, api.url(instance)); - } - - @Test - public void isForMainFrame() { - final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); - - final WebResourceRequest instance = mock(WebResourceRequest.class); - final Boolean value = true; - when(instance.getIsForMainFrame()).thenReturn(value); - - assertEquals(value, api.isForMainFrame(instance)); - } - - @Test - public void isRedirect() { - final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); - - final WebResourceRequest instance = mock(WebResourceRequest.class); - final Boolean value = true; - when(instance.getIsRedirect()).thenReturn(value); - - assertEquals(value, api.isRedirect(instance)); - } - - @Test - public void hasGesture() { - final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); - - final WebResourceRequest instance = mock(WebResourceRequest.class); - final Boolean value = true; - when(instance.getHasGesture()).thenReturn(value); - - assertEquals(value, api.hasGesture(instance)); - } - - @Test - public void method() { - final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); - - final WebResourceRequest instance = mock(WebResourceRequest.class); - final String value = "myString"; - when(instance.getMethod()).thenReturn(value); - - assertEquals(value, api.method(instance)); - } - - @Test - public void requestHeaders() { - final PigeonApiWebResourceRequest api = new TestProxyApiRegistrar().getPigeonApiWebResourceRequest(); - - final WebResourceRequest instance = mock(WebResourceRequest.class); - final Map value = new HashMap() {{put("myString", "myString")}}; - when(instance.getRequestHeaders()).thenReturn(value); - - assertEquals(value, api.requestHeaders(instance)); - } - } -*/ /** * Encapsulates a resource response. * * See https://developer.android.com/reference/android/webkit/WebResourceResponse. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebResourceResponse(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiWebResourceResponse( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** The resource response's status code. */ abstract fun statusCode(pigeon_instance: android.webkit.WebResourceResponse): Long @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebResourceResponse and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebResourceResponse, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebResourceResponse, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val statusCodeArg = statusCode(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebResourceResponse.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebResourceResponse.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, statusCodeArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebResourceResponse; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebResourceResponse}. - * 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 WebResourceResponseProxyApi extends PigeonApiWebResourceResponse { - WebResourceResponseProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public Long statusCode(WebResourceResponse pigeon_instance) { - return pigeon_instance.getStatusCode(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebResourceResponse; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebResourceResponseTest { - @Test - public void statusCode() { - final PigeonApiWebResourceResponse api = new TestProxyApiRegistrar().getPigeonApiWebResourceResponse(); - - final WebResourceResponse instance = mock(WebResourceResponse.class); - final Long value = 0; - when(instance.getStatusCode()).thenReturn(value); - - assertEquals(value, api.statusCode(instance)); - } - } -*/ /** - * Encapsulates information about errors that occurred during loading of web - * resources. + * Encapsulates information about errors that occurred during loading of web resources. * * See https://developer.android.com/reference/android/webkit/WebResourceError. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebResourceError(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiWebResourceError( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** The error code of the error. */ @androidx.annotation.RequiresApi(api = 23) abstract fun errorCode(pigeon_instance: android.webkit.WebResourceError): Long @@ -1267,130 +1079,52 @@ abstract class PigeonApiWebResourceError(open val pigeonRegistrar: AndroidWebkit @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebResourceError and attaches it to [pigeon_instanceArg]. */ @androidx.annotation.RequiresApi(api = 23) - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebResourceError, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebResourceError, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorCodeArg = errorCode(pigeon_instanceArg) val descriptionArg = description(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebResourceError.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebResourceError.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, errorCodeArg, descriptionArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebResourceError; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebResourceError}. - * 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 WebResourceErrorProxyApi extends PigeonApiWebResourceError { - WebResourceErrorProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public Long errorCode(WebResourceError pigeon_instance) { - return pigeon_instance.getErrorCode(); - } - - @NonNull - @Override - public String description(WebResourceError pigeon_instance) { - return pigeon_instance.getDescription(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebResourceError; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebResourceErrorTest { - @Test - public void errorCode() { - final PigeonApiWebResourceError api = new TestProxyApiRegistrar().getPigeonApiWebResourceError(); - - final WebResourceError instance = mock(WebResourceError.class); - final Long value = 0; - when(instance.getErrorCode()).thenReturn(value); - - assertEquals(value, api.errorCode(instance)); - } - - @Test - public void description() { - final PigeonApiWebResourceError api = new TestProxyApiRegistrar().getPigeonApiWebResourceError(); - - final WebResourceError instance = mock(WebResourceError.class); - final String value = "myString"; - when(instance.getDescription()).thenReturn(value); - - assertEquals(value, api.description(instance)); - } - } -*/ /** - * Encapsulates information about errors that occurred during loading of web - * resources. + * Encapsulates information about errors that occurred during loading of web resources. * * See https://developer.android.com/reference/androidx/webkit/WebResourceErrorCompat. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebResourceErrorCompat(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiWebResourceErrorCompat( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** The error code of the error. */ abstract fun errorCode(pigeon_instance: androidx.webkit.WebResourceErrorCompat): Long @@ -1399,145 +1133,68 @@ abstract class PigeonApiWebResourceErrorCompat(open val pigeonRegistrar: Android @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebResourceErrorCompat and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: androidx.webkit.WebResourceErrorCompat, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: androidx.webkit.WebResourceErrorCompat, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val errorCodeArg = errorCode(pigeon_instanceArg) val descriptionArg = description(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebResourceErrorCompat.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebResourceErrorCompat.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, errorCodeArg, descriptionArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import androidx.webkit.WebResourceErrorCompat; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebResourceErrorCompat}. - * 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 WebResourceErrorCompatProxyApi extends PigeonApiWebResourceErrorCompat { - WebResourceErrorCompatProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public Long errorCode(WebResourceErrorCompat pigeon_instance) { - return pigeon_instance.getErrorCode(); - } - - @NonNull - @Override - public String description(WebResourceErrorCompat pigeon_instance) { - return pigeon_instance.getDescription(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import androidx.webkit.WebResourceErrorCompat; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebResourceErrorCompatTest { - @Test - public void errorCode() { - final PigeonApiWebResourceErrorCompat api = new TestProxyApiRegistrar().getPigeonApiWebResourceErrorCompat(); - - final WebResourceErrorCompat instance = mock(WebResourceErrorCompat.class); - final Long value = 0; - when(instance.getErrorCode()).thenReturn(value); - - assertEquals(value, api.errorCode(instance)); - } - - @Test - public void description() { - final PigeonApiWebResourceErrorCompat api = new TestProxyApiRegistrar().getPigeonApiWebResourceErrorCompat(); - - final WebResourceErrorCompat instance = mock(WebResourceErrorCompat.class); - final String value = "myString"; - when(instance.getDescription()).thenReturn(value); - - assertEquals(value, api.description(instance)); - } - } -*/ /** * Represents a position on a web page. * * This is a custom class created for convenience of the wrapper. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebViewPoint(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiWebViewPoint( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun x(pigeon_instance: WebViewPoint): Long abstract fun y(pigeon_instance: WebViewPoint): Long @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebViewPoint and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: WebViewPoint, callback: (Result) -> Unit) -{ + fun pigeon_newInstance(pigeon_instanceArg: WebViewPoint, callback: (Result) -> Unit) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val xArg = x(pigeon_instanceArg) val yArg = y(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -1547,110 +1204,29 @@ abstract class PigeonApiWebViewPoint(open val pigeonRegistrar: AndroidWebkitLibr channel.send(listOf(pigeon_identifierArg, xArg, yArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebViewPoint}. - * 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 WebViewPointProxyApi extends PigeonApiWebViewPoint { - WebViewPointProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public Long x(WebViewPoint pigeon_instance) { - return pigeon_instance.getX(); - } - - @NonNull - @Override - public Long y(WebViewPoint pigeon_instance) { - return pigeon_instance.getY(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - - -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebViewPointTest { - @Test - public void x() { - final PigeonApiWebViewPoint api = new TestProxyApiRegistrar().getPigeonApiWebViewPoint(); - - final WebViewPoint instance = mock(WebViewPoint.class); - final Long value = 0; - when(instance.getX()).thenReturn(value); - - assertEquals(value, api.x(instance)); - } - - @Test - public void y() { - final PigeonApiWebViewPoint api = new TestProxyApiRegistrar().getPigeonApiWebViewPoint(); - - final WebViewPoint instance = mock(WebViewPoint.class); - final Long value = 0; - when(instance.getY()).thenReturn(value); - - assertEquals(value, api.y(instance)); - } - } -*/ /** * Represents a JavaScript console message from WebCore. * * See https://developer.android.com/reference/android/webkit/ConsoleMessage */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiConsoleMessage(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiConsoleMessage( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun lineNumber(pigeon_instance: android.webkit.ConsoleMessage): Long abstract fun message(pigeon_instance: android.webkit.ConsoleMessage): String @@ -1661,199 +1237,94 @@ abstract class PigeonApiConsoleMessage(open val pigeonRegistrar: AndroidWebkitLi @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of ConsoleMessage and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.ConsoleMessage, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.ConsoleMessage, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val lineNumberArg = lineNumber(pigeon_instanceArg) val messageArg = message(pigeon_instanceArg) val levelArg = level(pigeon_instanceArg) val sourceIdArg = sourceId(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.ConsoleMessage.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.ConsoleMessage.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, lineNumberArg, messageArg, levelArg, sourceIdArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - } - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.ConsoleMessage; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link ConsoleMessage}. - * 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 ConsoleMessageProxyApi extends PigeonApiConsoleMessage { - ConsoleMessageProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public Long lineNumber(ConsoleMessage pigeon_instance) { - return pigeon_instance.getLineNumber(); - } - - @NonNull - @Override - public String message(ConsoleMessage pigeon_instance) { - return pigeon_instance.getMessage(); - } - - @NonNull - @Override - public ConsoleMessageLevel level(ConsoleMessage pigeon_instance) { - switch (pigeon_instance.level) { - case ConsoleMessageLevel.DEBUG: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.DEBUG; - case ConsoleMessageLevel.ERROR: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.ERROR; - case ConsoleMessageLevel.LOG: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.LOG; - case ConsoleMessageLevel.TIP: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.TIP; - case ConsoleMessageLevel.WARNING: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.WARNING; - default: return io.flutter.plugins.webviewflutter.ConsoleMessageLevel.UNKNOWN; - } - } - - @NonNull - @Override - public String sourceId(ConsoleMessage pigeon_instance) { - return pigeon_instance.getSourceId(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.ConsoleMessage; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class ConsoleMessageTest { - @Test - public void lineNumber() { - final PigeonApiConsoleMessage api = new TestProxyApiRegistrar().getPigeonApiConsoleMessage(); - - final ConsoleMessage instance = mock(ConsoleMessage.class); - final Long value = 0; - when(instance.getLineNumber()).thenReturn(value); - - assertEquals(value, api.lineNumber(instance)); - } - - @Test - public void message() { - final PigeonApiConsoleMessage api = new TestProxyApiRegistrar().getPigeonApiConsoleMessage(); - - final ConsoleMessage instance = mock(ConsoleMessage.class); - final String value = "myString"; - when(instance.getMessage()).thenReturn(value); - - assertEquals(value, api.message(instance)); - } - - @Test - public void level() { - final PigeonApiConsoleMessage api = new TestProxyApiRegistrar().getPigeonApiConsoleMessage(); - - final ConsoleMessage instance = mock(ConsoleMessage.class); - final ConsoleMessageLevel value = io.flutter.plugins.webviewflutter.ConsoleMessageLevel.DEBUG; - when(instance.getLevel()).thenReturn(value); - - assertEquals(value, api.level(instance)); - } - - @Test - public void sourceId() { - final PigeonApiConsoleMessage api = new TestProxyApiRegistrar().getPigeonApiConsoleMessage(); - - final ConsoleMessage instance = mock(ConsoleMessage.class); - final String value = "myString"; - when(instance.getSourceId()).thenReturn(value); - - assertEquals(value, api.sourceId(instance)); - } - -} -*/ /** * Manages the cookies used by an application's `WebView` instances. * * See https://developer.android.com/reference/android/webkit/CookieManager. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCookieManager(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiCookieManager( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun instance(): android.webkit.CookieManager /** Sets a single cookie (key-value pair) for the given URL. */ abstract fun setCookie(pigeon_instance: android.webkit.CookieManager, url: String, value: String) /** Removes all cookies. */ - abstract fun removeAllCookies(pigeon_instance: android.webkit.CookieManager, callback: (Result) -> Unit) + abstract fun removeAllCookies( + pigeon_instance: android.webkit.CookieManager, + callback: (Result) -> Unit + ) /** Sets whether the `WebView` should allow third party cookies to be set. */ - abstract fun setAcceptThirdPartyCookies(pigeon_instance: android.webkit.CookieManager, webView: android.webkit.WebView, accept: Boolean) + abstract fun setAcceptThirdPartyCookies( + pigeon_instance: android.webkit.CookieManager, + webView: android.webkit.WebView, + accept: Boolean + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCookieManager?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CookieManager.instance", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.CookieManager.instance", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1861,19 +1332,24 @@ abstract class PigeonApiCookieManager(open val pigeonRegistrar: AndroidWebkitLib } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CookieManager.setCookie", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.CookieManager.setCookie", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.CookieManager val urlArg = args[1] as String val valueArg = args[2] as String - val wrapped: List = try { - api.setCookie(pigeon_instanceArg, urlArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setCookie(pigeon_instanceArg, urlArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1881,7 +1357,11 @@ abstract class PigeonApiCookieManager(open val pigeonRegistrar: AndroidWebkitLib } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CookieManager.removeAllCookies", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.CookieManager.removeAllCookies", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -1901,19 +1381,24 @@ abstract class PigeonApiCookieManager(open val pigeonRegistrar: AndroidWebkitLib } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CookieManager.setAcceptThirdPartyCookies", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.CookieManager.setAcceptThirdPartyCookies", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.CookieManager val webViewArg = args[1] as android.webkit.WebView val acceptArg = args[2] as Boolean - val wrapped: List = try { - api.setAcceptThirdPartyCookies(pigeon_instanceArg, webViewArg, acceptArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setAcceptThirdPartyCookies(pigeon_instanceArg, webViewArg, acceptArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -1925,168 +1410,79 @@ abstract class PigeonApiCookieManager(open val pigeonRegistrar: AndroidWebkitLib @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of CookieManager and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.CookieManager, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.CookieManager, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.CookieManager.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.CookieManager.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.CookieManager; -import android.webkit.WebView; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link CookieManager}. - * 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 CookieManagerProxyApi extends PigeonApiCookieManager { - CookieManagerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public android.webkit.CookieManager instance() { - return CookieManager.getInstance(); - } - - @Override - public void setCookie(@NonNull CookieManager pigeon_instance,@NonNull String url, @NonNull String value) { - pigeon_instance.setCookie(url, value); - } - - @NonNull - @Override - public Boolean removeAllCookies(@NonNull CookieManager pigeon_instance) { - return pigeon_instance.removeAllCookies(); - } - - @Override - public void setAcceptThirdPartyCookies(@NonNull CookieManager pigeon_instance,@NonNull android.webkit.WebView webView, @NonNull Boolean accept) { - pigeon_instance.setAcceptThirdPartyCookies(webView, accept); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.CookieManager; -import android.webkit.WebView; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class CookieManagerTest { - @Test - public void setCookie() { - final PigeonApiCookieManager api = new TestProxyApiRegistrar().getPigeonApiCookieManager(); - - final CookieManager instance = mock(CookieManager.class); - final String url = "myString"; - final String value = "myString"; - api.setCookie(instance, url, value); - - verify(instance).setCookie(url, value); - } - - @Test - public void removeAllCookies() { - final PigeonApiCookieManager api = new TestProxyApiRegistrar().getPigeonApiCookieManager(); - - final CookieManager instance = mock(CookieManager.class); - final Boolean value = true; - when(instance.removeAllCookies()).thenReturn(value); - - assertEquals(value, api.removeAllCookies(instance )); - } - - @Test - public void setAcceptThirdPartyCookies() { - final PigeonApiCookieManager api = new TestProxyApiRegistrar().getPigeonApiCookieManager(); - - final CookieManager instance = mock(CookieManager.class); - final android.webkit.WebView webView = mock(WebView.class); - final Boolean accept = true; - api.setAcceptThirdPartyCookies(instance, webView, accept); - - verify(instance).setAcceptThirdPartyCookies(webView, accept); - } - } -*/ /** * A View that displays web pages. * * See https://developer.android.com/reference/android/webkit/WebView. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiWebView( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun pigeon_defaultConstructor(): android.webkit.WebView /** The WebSettings object used to control the settings for this WebView. */ abstract fun settings(pigeon_instance: android.webkit.WebView): android.webkit.WebSettings /** Loads the given data into this WebView using a 'data' scheme URL. */ - abstract fun loadData(pigeon_instance: android.webkit.WebView, data: String, mimeType: String?, encoding: String?) - - /** - * Loads the given data into this WebView, using baseUrl as the base URL for - * the content. - */ - abstract fun loadDataWithBaseUrl(pigeon_instance: android.webkit.WebView, baseUrl: String?, data: String, mimeType: String?, encoding: String?, historyUrl: String?) + abstract fun loadData( + pigeon_instance: android.webkit.WebView, + data: String, + mimeType: String?, + encoding: String? + ) + + /** Loads the given data into this WebView, using baseUrl as the base URL for the content. */ + abstract fun loadDataWithBaseUrl( + pigeon_instance: android.webkit.WebView, + baseUrl: String?, + data: String, + mimeType: String?, + encoding: String?, + historyUrl: String? + ) /** Loads the given URL. */ - abstract fun loadUrl(pigeon_instance: android.webkit.WebView, url: String, headers: Map) + abstract fun loadUrl( + pigeon_instance: android.webkit.WebView, + url: String, + headers: Map + ) /** Loads the URL with postData using "POST" method into this WebView. */ abstract fun postUrl(pigeon_instance: android.webkit.WebView, url: String, data: ByteArray) @@ -2112,41 +1508,51 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi /** Clears the resource cache. */ abstract fun clearCache(pigeon_instance: android.webkit.WebView, includeDiskFiles: Boolean) - /** - * Asynchronously evaluates JavaScript in the context of the currently - * displayed page. - */ - abstract fun evaluateJavascript(pigeon_instance: android.webkit.WebView, javascriptString: String, callback: (Result) -> Unit) + /** Asynchronously evaluates JavaScript in the context of the currently displayed page. */ + abstract fun evaluateJavascript( + pigeon_instance: android.webkit.WebView, + javascriptString: String, + callback: (Result) -> Unit + ) /** Gets the title for the current page. */ abstract fun getTitle(pigeon_instance: android.webkit.WebView): String? /** - * Enables debugging of web contents (HTML / CSS / JavaScript) loaded into - * any WebViews of this application. + * Enables debugging of web contents (HTML / CSS / JavaScript) loaded into any WebViews of this + * application. */ abstract fun setWebContentsDebuggingEnabled(enabled: Boolean) - /** - * Sets the WebViewClient that will receive various notifications and - * requests. - */ - abstract fun setWebViewClient(pigeon_instance: android.webkit.WebView, client: android.webkit.WebViewClient?) + /** Sets the WebViewClient that will receive various notifications and requests. */ + abstract fun setWebViewClient( + pigeon_instance: android.webkit.WebView, + client: android.webkit.WebViewClient? + ) /** Injects the supplied Java object into this WebView. */ - abstract fun addJavaScriptChannel(pigeon_instance: android.webkit.WebView, channel: JavaScriptChannel) + abstract fun addJavaScriptChannel( + pigeon_instance: android.webkit.WebView, + channel: JavaScriptChannel + ) /** Removes a previously injected Java object from this WebView. */ abstract fun removeJavaScriptChannel(pigeon_instance: android.webkit.WebView, name: String) /** - * Registers the interface to be used when content can not be handled by the - * rendering engine, and should be downloaded instead. + * Registers the interface to be used when content can not be handled by the rendering engine, and + * should be downloaded instead. */ - abstract fun setDownloadListener(pigeon_instance: android.webkit.WebView, listener: android.webkit.DownloadListener?) + abstract fun setDownloadListener( + pigeon_instance: android.webkit.WebView, + listener: android.webkit.DownloadListener? + ) /** Sets the chrome handler. */ - abstract fun setWebChromeClient(pigeon_instance: android.webkit.WebView, client: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl?) + abstract fun setWebChromeClient( + pigeon_instance: android.webkit.WebView, + client: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl? + ) /** Sets the background color for this view. */ abstract fun setBackgroundColor(pigeon_instance: android.webkit.WebView, color: Long) @@ -2159,17 +1565,23 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebView?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2177,18 +1589,24 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.settings", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.settings", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val pigeon_identifierArg = args[1] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.settings(pigeon_instanceArg), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.settings(pigeon_instanceArg), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2196,7 +1614,11 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.loadData", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.loadData", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2204,12 +1626,13 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi val dataArg = args[1] as String val mimeTypeArg = args[2] as String? val encodingArg = args[3] as String? - val wrapped: List = try { - api.loadData(pigeon_instanceArg, dataArg, mimeTypeArg, encodingArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.loadData(pigeon_instanceArg, dataArg, mimeTypeArg, encodingArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2217,7 +1640,11 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.loadDataWithBaseUrl", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.loadDataWithBaseUrl", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -2227,12 +1654,19 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi val mimeTypeArg = args[3] as String? val encodingArg = args[4] as String? val historyUrlArg = args[5] as String? - val wrapped: List = try { - api.loadDataWithBaseUrl(pigeon_instanceArg, baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.loadDataWithBaseUrl( + pigeon_instanceArg, + baseUrlArg, + dataArg, + mimeTypeArg, + encodingArg, + historyUrlArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2240,19 +1674,24 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.loadUrl", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.loadUrl", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val urlArg = args[1] as String val headersArg = args[2] as Map - val wrapped: List = try { - api.loadUrl(pigeon_instanceArg, urlArg, headersArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.loadUrl(pigeon_instanceArg, urlArg, headersArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2260,19 +1699,24 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.postUrl", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.postUrl", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val urlArg = args[1] as String val dataArg = args[2] as ByteArray - val wrapped: List = try { - api.postUrl(pigeon_instanceArg, urlArg, dataArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.postUrl(pigeon_instanceArg, urlArg, dataArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2280,16 +1724,19 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.getUrl", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.getUrl", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = try { - listOf(api.getUrl(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getUrl(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2297,16 +1744,21 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.canGoBack", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.canGoBack", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = try { - listOf(api.canGoBack(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.canGoBack(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2314,16 +1766,21 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.canGoForward", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.canGoForward", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = try { - listOf(api.canGoForward(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.canGoForward(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2331,17 +1788,20 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.goBack", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.goBack", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = try { - api.goBack(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.goBack(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2349,17 +1809,22 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.goForward", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.goForward", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = try { - api.goForward(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.goForward(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2367,17 +1832,20 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.reload", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.reload", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = try { - api.reload(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.reload(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2385,18 +1853,23 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.clearCache", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.clearCache", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val includeDiskFilesArg = args[1] as Boolean - val wrapped: List = try { - api.clearCache(pigeon_instanceArg, includeDiskFilesArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.clearCache(pigeon_instanceArg, includeDiskFilesArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2404,13 +1877,18 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.evaluateJavascript", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.evaluateJavascript", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val javascriptStringArg = args[1] as String - api.evaluateJavascript(pigeon_instanceArg, javascriptStringArg) { result: Result -> + api.evaluateJavascript(pigeon_instanceArg, javascriptStringArg) { + result: Result -> val error = result.exceptionOrNull() if (error != null) { reply.reply(AndroidWebkitLibraryPigeonUtils.wrapError(error)) @@ -2425,16 +1903,21 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.getTitle", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.getTitle", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = try { - listOf(api.getTitle(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getTitle(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2442,17 +1925,22 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setWebContentsDebuggingEnabled", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.setWebContentsDebuggingEnabled", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val enabledArg = args[0] as Boolean - val wrapped: List = try { - api.setWebContentsDebuggingEnabled(enabledArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setWebContentsDebuggingEnabled(enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2460,18 +1948,23 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setWebViewClient", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.setWebViewClient", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val clientArg = args[1] as android.webkit.WebViewClient? - val wrapped: List = try { - api.setWebViewClient(pigeon_instanceArg, clientArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setWebViewClient(pigeon_instanceArg, clientArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2479,18 +1972,23 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.addJavaScriptChannel", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.addJavaScriptChannel", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val channelArg = args[1] as JavaScriptChannel - val wrapped: List = try { - api.addJavaScriptChannel(pigeon_instanceArg, channelArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.addJavaScriptChannel(pigeon_instanceArg, channelArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2498,18 +1996,23 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.removeJavaScriptChannel", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.removeJavaScriptChannel", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val nameArg = args[1] as String - val wrapped: List = try { - api.removeJavaScriptChannel(pigeon_instanceArg, nameArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.removeJavaScriptChannel(pigeon_instanceArg, nameArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2517,18 +2020,23 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setDownloadListener", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.setDownloadListener", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val listenerArg = args[1] as android.webkit.DownloadListener? - val wrapped: List = try { - api.setDownloadListener(pigeon_instanceArg, listenerArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setDownloadListener(pigeon_instanceArg, listenerArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2536,18 +2044,26 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setWebChromeClient", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.setWebChromeClient", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val clientArg = args[1] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl? - val wrapped: List = try { - api.setWebChromeClient(pigeon_instanceArg, clientArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val clientArg = + args[1] + as + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl? + val wrapped: List = + try { + api.setWebChromeClient(pigeon_instanceArg, clientArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2555,18 +2071,23 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.setBackgroundColor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.setBackgroundColor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView val colorArg = args[1] as Long - val wrapped: List = try { - api.setBackgroundColor(pigeon_instanceArg, colorArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setBackgroundColor(pigeon_instanceArg, colorArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2574,17 +2095,22 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebView.destroy", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebView.destroy", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebView - val wrapped: List = try { - api.destroy(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.destroy(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -2596,16 +2122,19 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebView and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebView, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebView, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.WebView.pigeon_newInstance" @@ -2613,23 +2142,32 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } /** - * This is called in response to an internal scroll in this view (i.e., the - * view scrolled its own contents). + * This is called in response to an internal scroll in this view (i.e., the view scrolled its own + * contents). */ - fun onScrollChanged(pigeon_instanceArg: android.webkit.WebView, leftArg: Long, topArg: Long, oldLeftArg: Long, oldTopArg: Long, callback: (Result) -> Unit) -{ + fun onScrollChanged( + pigeon_instanceArg: android.webkit.WebView, + leftArg: Long, + topArg: Long, + oldLeftArg: Long, + oldTopArg: Long, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -2643,561 +2181,132 @@ abstract class PigeonApiWebView(open val pigeonRegistrar: AndroidWebkitLibraryPi channel.send(listOf(pigeon_instanceArg, leftArg, topArg, oldLeftArg, oldTopArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } @Suppress("FunctionName") /** An implementation of [PigeonApiView] used to access callback methods */ - fun pigeon_getPigeonApiView(): PigeonApiView - { + fun pigeon_getPigeonApiView(): PigeonApiView { return pigeonRegistrar.getPigeonApiView() } - } - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebView; -import android.webkit.WebSettings; -import android.webkit.WebViewClient; -import android.webkit.DownloadListener; -import io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - /** - * ProxyApi implementation for {@link WebView}. - * 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. + * Manages settings state for a `WebView`. + * + * See https://developer.android.com/reference/android/webkit/WebSettings. */ -class WebViewProxyApi extends PigeonApiWebView { - WebViewProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - /** Implementation of {@link WebView} that passes arguments of callback methods to Dart. */ - static class WebViewImpl extends WebView { - private final WebViewProxyApi api; - WebViewImpl(@NonNull WebViewProxyApi api) { - this.api = api; - } - @Override - public void onScrollChanged(@NonNull Long left, @NonNull Long top, @NonNull Long oldLeft, @NonNull Long oldTop) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onScrollChanged(this, left, top, oldLeft, oldTop, reply -> null)); - } - } - - @NonNull - @Override - public WebView pigeon_defaultConstructor() { - return WebViewImpl(); - } - - @NonNull - @Override - public android.webkit.WebSettings settings(WebView pigeon_instance) { - return pigeon_instance.getSettings(); - } - - @Override - public void loadData(@NonNull WebView pigeon_instance,@NonNull String data, @Nullable String? mimeType, @Nullable String? encoding) { - pigeon_instance.loadData(data, mimeType, encoding); - } - - @Override - public void loadDataWithBaseUrl(@NonNull WebView pigeon_instance,@Nullable String? baseUrl, @NonNull String data, @Nullable String? mimeType, @Nullable String? encoding, @Nullable String? historyUrl) { - pigeon_instance.loadDataWithBaseUrl(baseUrl, data, mimeType, encoding, historyUrl); - } - - @Override - public void loadUrl(@NonNull WebView pigeon_instance,@NonNull String url, @NonNull Map headers) { - pigeon_instance.loadUrl(url, headers); - } - - @Override - public void postUrl(@NonNull WebView pigeon_instance,@NonNull String url, @NonNull ByteArray data) { - pigeon_instance.postUrl(url, data); - } - - @Nullable - @Override - public String getUrl(@NonNull WebView pigeon_instance) { - return pigeon_instance.getUrl(); - } - - @NonNull - @Override - public Boolean canGoBack(@NonNull WebView pigeon_instance) { - return pigeon_instance.canGoBack(); - } - - @NonNull - @Override - public Boolean canGoForward(@NonNull WebView pigeon_instance) { - return pigeon_instance.canGoForward(); - } - - @Override - public void goBack(@NonNull WebView pigeon_instance) { - pigeon_instance.goBack(); - } - - @Override - public void goForward(@NonNull WebView pigeon_instance) { - pigeon_instance.goForward(); - } - - @Override - public void reload(@NonNull WebView pigeon_instance) { - pigeon_instance.reload(); - } - - @Override - public void clearCache(@NonNull WebView pigeon_instance,@NonNull Boolean includeDiskFiles) { - pigeon_instance.clearCache(includeDiskFiles); - } - - @Nullable - @Override - public String evaluateJavascript(@NonNull WebView pigeon_instance,@NonNull String javascriptString) { - return pigeon_instance.evaluateJavascript(javascriptString); - } - - @Nullable - @Override - public String getTitle(@NonNull WebView pigeon_instance) { - return pigeon_instance.getTitle(); - } - - @Override - public void setWebContentsDebuggingEnabled(@NonNull Boolean enabled) { - WebView.setWebContentsDebuggingEnabled(enabled); - } - - @Override - public void setWebViewClient(@NonNull WebView pigeon_instance,@Nullable android.webkit.WebViewClient? client) { - pigeon_instance.setWebViewClient(client); - } - - @Override - public void addJavaScriptChannel(@NonNull WebView pigeon_instance,@NonNull JavaScriptChannel channel) { - pigeon_instance.addJavaScriptChannel(channel); - } - - @Override - public void removeJavaScriptChannel(@NonNull WebView pigeon_instance,@NonNull String name) { - pigeon_instance.removeJavaScriptChannel(name); - } - - @Override - public void setDownloadListener(@NonNull WebView pigeon_instance,@Nullable android.webkit.DownloadListener? listener) { - pigeon_instance.setDownloadListener(listener); - } - - @Override - public void setWebChromeClient(@NonNull WebView pigeon_instance,@Nullable io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl? client) { - pigeon_instance.setWebChromeClient(client); - } - - @Override - public void setBackgroundColor(@NonNull WebView pigeon_instance,@NonNull Long color) { - pigeon_instance.setBackgroundColor(color); - } - - @Override - public void destroy(@NonNull WebView pigeon_instance) { - pigeon_instance.destroy(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebView; -import android.webkit.WebSettings; -import android.webkit.WebViewClient; -import android.webkit.DownloadListener; -import io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebViewTest { - @Test - public void pigeon_defaultConstructor() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - assertTrue(api.pigeon_defaultConstructor() instanceof WebViewProxyApi.WebView); - } - - @Test - public void settings() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final android.webkit.WebSettings value = mock(WebSettings.class); - when(instance.getSettings()).thenReturn(value); - - assertEquals(value, api.settings(instance)); - } - - @Test - public void loadData() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final String data = "myString"; - final String mimeType = "myString"; - final String encoding = "myString"; - api.loadData(instance, data, mimeType, encoding); - - verify(instance).loadData(data, mimeType, encoding); - } - - @Test - public void loadDataWithBaseUrl() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final String baseUrl = "myString"; - final String data = "myString"; - final String mimeType = "myString"; - final String encoding = "myString"; - final String historyUrl = "myString"; - api.loadDataWithBaseUrl(instance, baseUrl, data, mimeType, encoding, historyUrl); - - verify(instance).loadDataWithBaseUrl(baseUrl, data, mimeType, encoding, historyUrl); - } - - @Test - public void loadUrl() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final String url = "myString"; - final Map headers = new HashMap() {{put("myString", "myString")}}; - api.loadUrl(instance, url, headers); - - verify(instance).loadUrl(url, headers); - } - - @Test - public void postUrl() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final String url = "myString"; - final ByteArray data = {0xA1}; - api.postUrl(instance, url, data); - - verify(instance).postUrl(url, data); - } - - @Test - public void getUrl() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final String value = "myString"; - when(instance.getUrl()).thenReturn(value); - - assertEquals(value, api.getUrl(instance )); - } - - @Test - public void canGoBack() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final Boolean value = true; - when(instance.canGoBack()).thenReturn(value); - - assertEquals(value, api.canGoBack(instance )); - } - - @Test - public void canGoForward() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final Boolean value = true; - when(instance.canGoForward()).thenReturn(value); - - assertEquals(value, api.canGoForward(instance )); - } - - @Test - public void goBack() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - api.goBack(instance ); - - verify(instance).goBack(); - } - - @Test - public void goForward() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - api.goForward(instance ); - - verify(instance).goForward(); - } +@Suppress("UNCHECKED_CAST") +abstract class PigeonApiWebSettings( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { + /** Sets whether the DOM storage API is enabled. */ + abstract fun setDomStorageEnabled(pigeon_instance: android.webkit.WebSettings, flag: Boolean) - @Test - public void reload() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + /** Tells JavaScript to open windows automatically. */ + abstract fun setJavaScriptCanOpenWindowsAutomatically( + pigeon_instance: android.webkit.WebSettings, + flag: Boolean + ) - final WebView instance = mock(WebView.class); - api.reload(instance ); + /** Sets whether the WebView whether supports multiple windows. */ + abstract fun setSupportMultipleWindows( + pigeon_instance: android.webkit.WebSettings, + support: Boolean + ) - verify(instance).reload(); - } + /** Tells the WebView to enable JavaScript execution. */ + abstract fun setJavaScriptEnabled(pigeon_instance: android.webkit.WebSettings, flag: Boolean) - @Test - public void clearCache() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + /** Sets the WebView's user-agent string. */ + abstract fun setUserAgentString( + pigeon_instance: android.webkit.WebSettings, + userAgentString: String? + ) - final WebView instance = mock(WebView.class); - final Boolean includeDiskFiles = true; - api.clearCache(instance, includeDiskFiles); + /** Sets whether the WebView requires a user gesture to play media. */ + abstract fun setMediaPlaybackRequiresUserGesture( + pigeon_instance: android.webkit.WebSettings, + require: Boolean + ) - verify(instance).clearCache(includeDiskFiles); - } + /** + * Sets whether the WebView should support zooming using its on-screen zoom controls and gestures. + */ + abstract fun setSupportZoom(pigeon_instance: android.webkit.WebSettings, support: Boolean) - @Test - public void evaluateJavascript() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + /** + * Sets whether the WebView loads pages in overview mode, that is, zooms out the content to fit on + * screen by width. + */ + abstract fun setLoadWithOverviewMode( + pigeon_instance: android.webkit.WebSettings, + overview: Boolean + ) - final WebView instance = mock(WebView.class); - final String javascriptString = "myString"; - final String value = "myString"; - when(instance.evaluateJavascript(javascriptString)).thenReturn(value); + /** + * Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a + * wide viewport. + */ + abstract fun setUseWideViewPort(pigeon_instance: android.webkit.WebSettings, use: Boolean) - assertEquals(value, api.evaluateJavascript(instance, javascriptString)); - } + /** + * Sets whether the WebView should display on-screen zoom controls when using the built-in zoom + * mechanisms. + */ + abstract fun setDisplayZoomControls(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - @Test - public void getTitle() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + /** + * Sets whether the WebView should display on-screen zoom controls when using the built-in zoom + * mechanisms. + */ + abstract fun setBuiltInZoomControls(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - final WebView instance = mock(WebView.class); - final String value = "myString"; - when(instance.getTitle()).thenReturn(value); + /** Enables or disables file access within WebView. */ + abstract fun setAllowFileAccess(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - assertEquals(value, api.getTitle(instance )); - } + /** Enables or disables content URL access within WebView. */ + abstract fun setAllowContentAccess(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - @Test - public void setWebViewClient() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); + /** Sets whether Geolocation is enabled within WebView. */ + abstract fun setGeolocationEnabled(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - final WebView instance = mock(WebView.class); - final android.webkit.WebViewClient client = mock(WebViewClient.class); - api.setWebViewClient(instance, client); + /** Sets the text zoom of the page in percent. */ + abstract fun setTextZoom(pigeon_instance: android.webkit.WebSettings, textZoom: Long) - verify(instance).setWebViewClient(client); - } - - @Test - public void addJavaScriptChannel() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final JavaScriptChannel channel = mock(JavaScriptChannel.class); - api.addJavaScriptChannel(instance, channel); - - verify(instance).addJavaScriptChannel(channel); - } - - @Test - public void removeJavaScriptChannel() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final String name = "myString"; - api.removeJavaScriptChannel(instance, name); - - verify(instance).removeJavaScriptChannel(name); - } - - @Test - public void setDownloadListener() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final android.webkit.DownloadListener listener = mock(DownloadListener.class); - api.setDownloadListener(instance, listener); - - verify(instance).setDownloadListener(listener); - } - - @Test - public void setWebChromeClient() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl client = mock(WebChromeClient.class); - api.setWebChromeClient(instance, client); - - verify(instance).setWebChromeClient(client); - } - - @Test - public void setBackgroundColor() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - final Long color = 0; - api.setBackgroundColor(instance, color); - - verify(instance).setBackgroundColor(color); - } - - @Test - public void destroy() { - final PigeonApiWebView api = new TestProxyApiRegistrar().getPigeonApiWebView(); - - final WebView instance = mock(WebView.class); - api.destroy(instance ); - - verify(instance).destroy(); - } - - @Test - public void onScrollChanged() { - final WebViewProxyApi mockApi = mock(WebViewProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewImpl instance = new WebViewImpl(mockApi); - final Long left = 0; - final Long top = 0; - final Long oldLeft = 0; - final Long oldTop = 0; - instance.onScrollChanged(left, top, oldLeft, oldTop); - - verify(mockApi).onScrollChanged(eq(instance), eq(left), eq(top), eq(oldLeft), eq(oldTop), any()); - } - -} -*/ -/** - * Manages settings state for a `WebView`. - * - * See https://developer.android.com/reference/android/webkit/WebSettings. - */ -@Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { - /** Sets whether the DOM storage API is enabled. */ - abstract fun setDomStorageEnabled(pigeon_instance: android.webkit.WebSettings, flag: Boolean) - - /** Tells JavaScript to open windows automatically. */ - abstract fun setJavaScriptCanOpenWindowsAutomatically(pigeon_instance: android.webkit.WebSettings, flag: Boolean) - - /** Sets whether the WebView whether supports multiple windows. */ - abstract fun setSupportMultipleWindows(pigeon_instance: android.webkit.WebSettings, support: Boolean) - - /** Tells the WebView to enable JavaScript execution. */ - abstract fun setJavaScriptEnabled(pigeon_instance: android.webkit.WebSettings, flag: Boolean) - - /** Sets the WebView's user-agent string. */ - abstract fun setUserAgentString(pigeon_instance: android.webkit.WebSettings, userAgentString: String?) - - /** Sets whether the WebView requires a user gesture to play media. */ - abstract fun setMediaPlaybackRequiresUserGesture(pigeon_instance: android.webkit.WebSettings, require: Boolean) - - /** - * Sets whether the WebView should support zooming using its on-screen zoom - * controls and gestures. - */ - abstract fun setSupportZoom(pigeon_instance: android.webkit.WebSettings, support: Boolean) - - /** - * Sets whether the WebView loads pages in overview mode, that is, zooms out - * the content to fit on screen by width. - */ - abstract fun setLoadWithOverviewMode(pigeon_instance: android.webkit.WebSettings, overview: Boolean) - - /** - * Sets whether the WebView should enable support for the "viewport" HTML - * meta tag or should use a wide viewport. - */ - abstract fun setUseWideViewPort(pigeon_instance: android.webkit.WebSettings, use: Boolean) - - /** - * Sets whether the WebView should display on-screen zoom controls when using - * the built-in zoom mechanisms. - */ - abstract fun setDisplayZoomControls(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - - /** - * Sets whether the WebView should display on-screen zoom controls when using - * the built-in zoom mechanisms. - */ - abstract fun setBuiltInZoomControls(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - - /** Enables or disables file access within WebView. */ - abstract fun setAllowFileAccess(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - - /** Enables or disables content URL access within WebView. */ - abstract fun setAllowContentAccess(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - - /** Sets whether Geolocation is enabled within WebView. */ - abstract fun setGeolocationEnabled(pigeon_instance: android.webkit.WebSettings, enabled: Boolean) - - /** Sets the text zoom of the page in percent. */ - abstract fun setTextZoom(pigeon_instance: android.webkit.WebSettings, textZoom: Long) - - /** Gets the WebView's user-agent string. */ - abstract fun getUserAgentString(pigeon_instance: android.webkit.WebSettings): String + /** Gets the WebView's user-agent string. */ + abstract fun getUserAgentString(pigeon_instance: android.webkit.WebSettings): String companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebSettings?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setDomStorageEnabled", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setDomStorageEnabled", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val flagArg = args[1] as Boolean - val wrapped: List = try { - api.setDomStorageEnabled(pigeon_instanceArg, flagArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setDomStorageEnabled(pigeon_instanceArg, flagArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3205,18 +2314,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setJavaScriptCanOpenWindowsAutomatically", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setJavaScriptCanOpenWindowsAutomatically", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val flagArg = args[1] as Boolean - val wrapped: List = try { - api.setJavaScriptCanOpenWindowsAutomatically(pigeon_instanceArg, flagArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setJavaScriptCanOpenWindowsAutomatically(pigeon_instanceArg, flagArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3224,18 +2338,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setSupportMultipleWindows", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setSupportMultipleWindows", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val supportArg = args[1] as Boolean - val wrapped: List = try { - api.setSupportMultipleWindows(pigeon_instanceArg, supportArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSupportMultipleWindows(pigeon_instanceArg, supportArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3243,18 +2362,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setJavaScriptEnabled", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setJavaScriptEnabled", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val flagArg = args[1] as Boolean - val wrapped: List = try { - api.setJavaScriptEnabled(pigeon_instanceArg, flagArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setJavaScriptEnabled(pigeon_instanceArg, flagArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3262,18 +2386,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setUserAgentString", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setUserAgentString", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val userAgentStringArg = args[1] as String? - val wrapped: List = try { - api.setUserAgentString(pigeon_instanceArg, userAgentStringArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setUserAgentString(pigeon_instanceArg, userAgentStringArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3281,18 +2410,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setMediaPlaybackRequiresUserGesture", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setMediaPlaybackRequiresUserGesture", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val requireArg = args[1] as Boolean - val wrapped: List = try { - api.setMediaPlaybackRequiresUserGesture(pigeon_instanceArg, requireArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setMediaPlaybackRequiresUserGesture(pigeon_instanceArg, requireArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3300,18 +2434,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setSupportZoom", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setSupportZoom", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val supportArg = args[1] as Boolean - val wrapped: List = try { - api.setSupportZoom(pigeon_instanceArg, supportArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSupportZoom(pigeon_instanceArg, supportArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3319,18 +2458,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setLoadWithOverviewMode", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setLoadWithOverviewMode", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val overviewArg = args[1] as Boolean - val wrapped: List = try { - api.setLoadWithOverviewMode(pigeon_instanceArg, overviewArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setLoadWithOverviewMode(pigeon_instanceArg, overviewArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3338,18 +2482,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setUseWideViewPort", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setUseWideViewPort", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val useArg = args[1] as Boolean - val wrapped: List = try { - api.setUseWideViewPort(pigeon_instanceArg, useArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setUseWideViewPort(pigeon_instanceArg, useArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3357,18 +2506,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setDisplayZoomControls", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setDisplayZoomControls", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = try { - api.setDisplayZoomControls(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setDisplayZoomControls(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3376,18 +2530,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setBuiltInZoomControls", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setBuiltInZoomControls", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = try { - api.setBuiltInZoomControls(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setBuiltInZoomControls(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3395,18 +2554,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setAllowFileAccess", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setAllowFileAccess", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = try { - api.setAllowFileAccess(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setAllowFileAccess(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3414,18 +2578,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setAllowContentAccess", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setAllowContentAccess", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = try { - api.setAllowContentAccess(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setAllowContentAccess(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3433,18 +2602,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setGeolocationEnabled", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setGeolocationEnabled", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val enabledArg = args[1] as Boolean - val wrapped: List = try { - api.setGeolocationEnabled(pigeon_instanceArg, enabledArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setGeolocationEnabled(pigeon_instanceArg, enabledArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3452,18 +2626,23 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.setTextZoom", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.setTextZoom", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings val textZoomArg = args[1] as Long - val wrapped: List = try { - api.setTextZoom(pigeon_instanceArg, textZoomArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setTextZoom(pigeon_instanceArg, textZoomArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3471,16 +2650,21 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebSettings.getUserAgentString", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebSettings.getUserAgentString", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebSettings - val wrapped: List = try { - listOf(api.getUserAgentString(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getUserAgentString(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3492,16 +2676,19 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebSettings and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebSettings, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebSettings, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.WebSettings.pigeon_newInstance" @@ -3509,326 +2696,20 @@ abstract class PigeonApiWebSettings(open val pigeonRegistrar: AndroidWebkitLibra channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebSettings; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebSettings}. - * 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 WebSettingsProxyApi extends PigeonApiWebSettings { - WebSettingsProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @Override - public void setDomStorageEnabled(@NonNull WebSettings pigeon_instance,@NonNull Boolean flag) { - pigeon_instance.setDomStorageEnabled(flag); - } - - @Override - public void setJavaScriptCanOpenWindowsAutomatically(@NonNull WebSettings pigeon_instance,@NonNull Boolean flag) { - pigeon_instance.setJavaScriptCanOpenWindowsAutomatically(flag); - } - - @Override - public void setSupportMultipleWindows(@NonNull WebSettings pigeon_instance,@NonNull Boolean support) { - pigeon_instance.setSupportMultipleWindows(support); - } - - @Override - public void setJavaScriptEnabled(@NonNull WebSettings pigeon_instance,@NonNull Boolean flag) { - pigeon_instance.setJavaScriptEnabled(flag); - } - - @Override - public void setUserAgentString(@NonNull WebSettings pigeon_instance,@Nullable String? userAgentString) { - pigeon_instance.setUserAgentString(userAgentString); - } - - @Override - public void setMediaPlaybackRequiresUserGesture(@NonNull WebSettings pigeon_instance,@NonNull Boolean require) { - pigeon_instance.setMediaPlaybackRequiresUserGesture(require); - } - - @Override - public void setSupportZoom(@NonNull WebSettings pigeon_instance,@NonNull Boolean support) { - pigeon_instance.setSupportZoom(support); - } - - @Override - public void setLoadWithOverviewMode(@NonNull WebSettings pigeon_instance,@NonNull Boolean overview) { - pigeon_instance.setLoadWithOverviewMode(overview); - } - - @Override - public void setUseWideViewPort(@NonNull WebSettings pigeon_instance,@NonNull Boolean use) { - pigeon_instance.setUseWideViewPort(use); - } - - @Override - public void setDisplayZoomControls(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { - pigeon_instance.setDisplayZoomControls(enabled); - } - - @Override - public void setBuiltInZoomControls(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { - pigeon_instance.setBuiltInZoomControls(enabled); - } - - @Override - public void setAllowFileAccess(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { - pigeon_instance.setAllowFileAccess(enabled); - } - - @Override - public void setAllowContentAccess(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { - pigeon_instance.setAllowContentAccess(enabled); - } - - @Override - public void setGeolocationEnabled(@NonNull WebSettings pigeon_instance,@NonNull Boolean enabled) { - pigeon_instance.setGeolocationEnabled(enabled); - } - - @Override - public void setTextZoom(@NonNull WebSettings pigeon_instance,@NonNull Long textZoom) { - pigeon_instance.setTextZoom(textZoom); - } - - @NonNull - @Override - public String getUserAgentString(@NonNull WebSettings pigeon_instance) { - return pigeon_instance.getUserAgentString(); - } - } -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebSettings; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebSettingsTest { - @Test - public void setDomStorageEnabled() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean flag = true; - api.setDomStorageEnabled(instance, flag); - - verify(instance).setDomStorageEnabled(flag); - } - - @Test - public void setJavaScriptCanOpenWindowsAutomatically() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean flag = true; - api.setJavaScriptCanOpenWindowsAutomatically(instance, flag); - - verify(instance).setJavaScriptCanOpenWindowsAutomatically(flag); - } - - @Test - public void setSupportMultipleWindows() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean support = true; - api.setSupportMultipleWindows(instance, support); - - verify(instance).setSupportMultipleWindows(support); - } - - @Test - public void setJavaScriptEnabled() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean flag = true; - api.setJavaScriptEnabled(instance, flag); - - verify(instance).setJavaScriptEnabled(flag); - } - - @Test - public void setUserAgentString() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final String userAgentString = "myString"; - api.setUserAgentString(instance, userAgentString); - - verify(instance).setUserAgentString(userAgentString); - } - - @Test - public void setMediaPlaybackRequiresUserGesture() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean require = true; - api.setMediaPlaybackRequiresUserGesture(instance, require); - - verify(instance).setMediaPlaybackRequiresUserGesture(require); - } - - @Test - public void setSupportZoom() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean support = true; - api.setSupportZoom(instance, support); - - verify(instance).setSupportZoom(support); - } - - @Test - public void setLoadWithOverviewMode() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean overview = true; - api.setLoadWithOverviewMode(instance, overview); - - verify(instance).setLoadWithOverviewMode(overview); - } - - @Test - public void setUseWideViewPort() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean use = true; - api.setUseWideViewPort(instance, use); - - verify(instance).setUseWideViewPort(use); - } - - @Test - public void setDisplayZoomControls() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean enabled = true; - api.setDisplayZoomControls(instance, enabled); - - verify(instance).setDisplayZoomControls(enabled); - } - - @Test - public void setBuiltInZoomControls() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean enabled = true; - api.setBuiltInZoomControls(instance, enabled); - - verify(instance).setBuiltInZoomControls(enabled); - } - - @Test - public void setAllowFileAccess() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean enabled = true; - api.setAllowFileAccess(instance, enabled); - - verify(instance).setAllowFileAccess(enabled); - } - - @Test - public void setAllowContentAccess() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean enabled = true; - api.setAllowContentAccess(instance, enabled); - - verify(instance).setAllowContentAccess(enabled); - } - - @Test - public void setGeolocationEnabled() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Boolean enabled = true; - api.setGeolocationEnabled(instance, enabled); - - verify(instance).setGeolocationEnabled(enabled); - } - - @Test - public void setTextZoom() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final Long textZoom = 0; - api.setTextZoom(instance, textZoom); - - verify(instance).setTextZoom(textZoom); - } - - @Test - public void getUserAgentString() { - final PigeonApiWebSettings api = new TestProxyApiRegistrar().getPigeonApiWebSettings(); - - final WebSettings instance = mock(WebSettings.class); - final String value = "myString"; - when(instance.getUserAgentString()).thenReturn(value); - - assertEquals(value, api.getUserAgentString(instance )); - } - -} -*/ /** * A JavaScript interface for exposing Javascript callbacks to Dart. * @@ -3836,7 +2717,9 @@ public class WebSettingsTest { * [JavascriptInterface](https://developer.android.com/reference/android/webkit/JavascriptInterface). */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiJavaScriptChannel(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiJavaScriptChannel( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun pigeon_defaultConstructor(channelName: String): JavaScriptChannel companion object { @@ -3844,18 +2727,24 @@ abstract class PigeonApiJavaScriptChannel(open val pigeonRegistrar: AndroidWebki fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiJavaScriptChannel?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.JavaScriptChannel.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.JavaScriptChannel.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long val channelNameArg = args[1] as String - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(channelNameArg), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(channelNameArg), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -3867,24 +2756,29 @@ abstract class PigeonApiJavaScriptChannel(open val pigeonRegistrar: AndroidWebki @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of JavaScriptChannel and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: JavaScriptChannel, callback: (Result) -> Unit) -{ + fun pigeon_newInstance(pigeon_instanceArg: JavaScriptChannel, callback: (Result) -> Unit) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - AndroidWebKitError("new-instance-error", "Attempting to create a new Dart instance of JavaScriptChannel, but the class has a nonnull callback method.", ""))) + AndroidWebKitError( + "new-instance-error", + "Attempting to create a new Dart instance of JavaScriptChannel, but the class has a nonnull callback method.", + ""))) } } /** Handles callbacks messages from JavaScript. */ - fun postMessage(pigeon_instanceArg: JavaScriptChannel, messageArg: String, callback: (Result) -> Unit) -{ + fun postMessage( + pigeon_instanceArg: JavaScriptChannel, + messageArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -3898,162 +2792,69 @@ abstract class PigeonApiJavaScriptChannel(open val pigeonRegistrar: AndroidWebki channel.send(listOf(pigeon_instanceArg, messageArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } - } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link JavaScriptChannel}. - * 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 JavaScriptChannelProxyApi extends PigeonApiJavaScriptChannel { - JavaScriptChannelProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - /** Implementation of {@link JavaScriptChannel} that passes arguments of callback methods to Dart. */ - static class JavaScriptChannelImpl extends JavaScriptChannel { - private final JavaScriptChannelProxyApi api; - JavaScriptChannelImpl(@NonNull JavaScriptChannelProxyApi api) { - this.api = api; - } - @Override - public void postMessage(@NonNull String message) { - api.getPigeonRegistrar().runOnMainThread(() -> api.postMessage(this, message, reply -> null)); + } } } - - @NonNull - @Override - public JavaScriptChannel pigeon_defaultConstructor(@NonNull String channelName) { - return JavaScriptChannelImpl(); - } - - @NonNull - @Override - public String channelName(JavaScriptChannel pigeon_instance) { - return pigeon_instance.getChannelName(); - } - } -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - - -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class JavaScriptChannelTest { - @Test - public void pigeon_defaultConstructor() { - final PigeonApiJavaScriptChannel api = new TestProxyApiRegistrar().getPigeonApiJavaScriptChannel(); - - assertTrue(api.pigeon_defaultConstructor() instanceof JavaScriptChannelProxyApi.JavaScriptChannel); - } - - @Test - public void channelName() { - final PigeonApiJavaScriptChannel api = new TestProxyApiRegistrar().getPigeonApiJavaScriptChannel(); - - final JavaScriptChannel instance = mock(JavaScriptChannel.class); - final String value = "myString"; - when(instance.getChannelName()).thenReturn(value); - - assertEquals(value, api.channelName(instance)); - } - - @Test - public void postMessage() { - final JavaScriptChannelProxyApi mockApi = mock(JavaScriptChannelProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final JavaScriptChannelImpl instance = new JavaScriptChannelImpl(mockApi); - final String message = "myString"; - instance.postMessage(message); - - verify(mockApi).postMessage(eq(instance), eq(message), any()); - } - -} -*/ /** * Receives various notifications and requests from a `WebView`. * * See https://developer.android.com/reference/android/webkit/WebViewClient. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiWebViewClient( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun pigeon_defaultConstructor(): android.webkit.WebViewClient /** * Sets the required synchronous return value for the Java method, * `WebViewClient.shouldOverrideUrlLoading(...)`. * - * The Java method, `WebViewClient.shouldOverrideUrlLoading(...)`, requires - * a boolean to be returned and this method sets the returned value for all - * calls to the Java method. + * The Java method, `WebViewClient.shouldOverrideUrlLoading(...)`, requires a boolean to be + * returned and this method sets the returned value for all calls to the Java method. * - * Setting this to true causes the current [WebView] to abort loading any URL - * received by [requestLoading] or [urlLoading], while setting this to false - * causes the [WebView] to continue loading a URL as usual. + * Setting this to true causes the current [WebView] to abort loading any URL received by + * [requestLoading] or [urlLoading], while setting this to false causes the [WebView] to continue + * loading a URL as usual. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForShouldOverrideUrlLoading(pigeon_instance: android.webkit.WebViewClient, value: Boolean) + abstract fun setSynchronousReturnValueForShouldOverrideUrlLoading( + pigeon_instance: android.webkit.WebViewClient, + value: Boolean + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebViewClient?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebViewClient.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4061,18 +2862,24 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebViewClient.setSynchronousReturnValueForShouldOverrideUrlLoading", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.setSynchronousReturnValueForShouldOverrideUrlLoading", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebViewClient val valueArg = args[1] as Boolean - val wrapped: List = try { - api.setSynchronousReturnValueForShouldOverrideUrlLoading(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -4084,37 +2891,48 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebViewClient and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebViewClient, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebViewClient, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } /** Notify the host application that a page has started loading. */ - fun onPageStarted(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) -{ + fun onPageStarted( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + urlArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4128,19 +2946,25 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Notify the host application that a page has finished loading. */ - fun onPageFinished(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) -{ + fun onPageFinished( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + urlArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4154,22 +2978,29 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that an HTTP error has been received from the - * server while loading a resource. + * Notify the host application that an HTTP error has been received from the server while loading + * a resource. */ - fun onReceivedHttpError(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, requestArg: android.webkit.WebResourceRequest, responseArg: android.webkit.WebResourceResponse, callback: (Result) -> Unit) -{ + fun onReceivedHttpError( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + requestArg: android.webkit.WebResourceRequest, + responseArg: android.webkit.WebResourceResponse, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4183,20 +3014,27 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, webViewArg, requestArg, responseArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Report web resource loading error to the host application. */ @androidx.annotation.RequiresApi(api = 23) - fun onReceivedRequestError(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, requestArg: android.webkit.WebResourceRequest, errorArg: android.webkit.WebResourceError, callback: (Result) -> Unit) -{ + fun onReceivedRequestError( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + requestArg: android.webkit.WebResourceRequest, + errorArg: android.webkit.WebResourceError, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4205,24 +3043,32 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedRequestError" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedRequestError" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, webViewArg, requestArg, errorArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Report web resource loading error to the host application. */ - fun onReceivedRequestErrorCompat(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, requestArg: android.webkit.WebResourceRequest, errorArg: androidx.webkit.WebResourceErrorCompat, callback: (Result) -> Unit) -{ + fun onReceivedRequestErrorCompat( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + requestArg: android.webkit.WebResourceRequest, + errorArg: androidx.webkit.WebResourceErrorCompat, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4231,24 +3077,33 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedRequestErrorCompat" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedRequestErrorCompat" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, webViewArg, requestArg, errorArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Report an error to the host application. */ - fun onReceivedError(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, errorCodeArg: Long, descriptionArg: String, failingUrlArg: String, callback: (Result) -> Unit) -{ + fun onReceivedError( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + errorCodeArg: Long, + descriptionArg: String, + failingUrlArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4259,25 +3114,33 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedError" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_instanceArg, webViewArg, errorCodeArg, descriptionArg, failingUrlArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) + channel.send( + listOf(pigeon_instanceArg, webViewArg, errorCodeArg, descriptionArg, failingUrlArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } - } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } } /** - * Give the host application a chance to take control when a URL is about to - * be loaded in the current WebView. + * Give the host application a chance to take control when a URL is about to be loaded in the + * current WebView. */ - fun requestLoading(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, requestArg: android.webkit.WebResourceRequest, callback: (Result) -> Unit) -{ + fun requestLoading( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + requestArg: android.webkit.WebResourceRequest, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4291,22 +3154,28 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, webViewArg, requestArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Give the host application a chance to take control when a URL is about to - * be loaded in the current WebView. + * Give the host application a chance to take control when a URL is about to be loaded in the + * current WebView. */ - fun urlLoading(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) -{ + fun urlLoading( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + urlArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4320,19 +3189,26 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Notify the host application to update its visited links database. */ - fun doUpdateVisitedHistory(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, urlArg: String, isReloadArg: Boolean, callback: (Result) -> Unit) -{ + fun doUpdateVisitedHistory( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + urlArg: String, + isReloadArg: Boolean, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4341,27 +3217,33 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.doUpdateVisitedHistory" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.doUpdateVisitedHistory" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, isReloadArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } - /** - * Notifies the host application that the WebView received an HTTP - * authentication request. - */ - fun onReceivedHttpAuthRequest(pigeon_instanceArg: android.webkit.WebViewClient, webViewArg: android.webkit.WebView, handlerArg: android.webkit.HttpAuthHandler, hostArg: String, realmArg: String, callback: (Result) -> Unit) -{ + /** Notifies the host application that the WebView received an HTTP authentication request. */ + fun onReceivedHttpAuthRequest( + pigeon_instanceArg: android.webkit.WebViewClient, + webViewArg: android.webkit.WebView, + handlerArg: android.webkit.HttpAuthHandler, + hostArg: String, + realmArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4370,27 +3252,35 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedHttpAuthRequest" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedHttpAuthRequest" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, webViewArg, handlerArg, hostArg, realmArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Ask the host application if the browser should resend data as the - * requested page was a result of a POST. + * Ask the host application if the browser should resend data as the requested page was a result + * of a POST. */ - fun onFormResubmission(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, dontResendArg: android.os.Message, resendArg: android.os.Message, callback: (Result) -> Unit) -{ + fun onFormResubmission( + pigeon_instanceArg: android.webkit.WebViewClient, + viewArg: android.webkit.WebView, + dontResendArg: android.os.Message, + resendArg: android.os.Message, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4404,22 +3294,27 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, viewArg, dontResendArg, resendArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that the WebView will load the resource - * specified by the given url. + * Notify the host application that the WebView will load the resource specified by the given url. */ - fun onLoadResource(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) -{ + fun onLoadResource( + pigeon_instanceArg: android.webkit.WebViewClient, + viewArg: android.webkit.WebView, + urlArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4433,22 +3328,28 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, viewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that WebView content left over from previous - * page navigations will no longer be drawn. + * Notify the host application that WebView content left over from previous page navigations will + * no longer be drawn. */ - fun onPageCommitVisible(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, urlArg: String, callback: (Result) -> Unit) -{ + fun onPageCommitVisible( + pigeon_instanceArg: android.webkit.WebViewClient, + viewArg: android.webkit.WebView, + urlArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4462,19 +3363,25 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, viewArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Notify the host application to handle a SSL client certificate request. */ - fun onReceivedClientCertRequest(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, requestArg: android.webkit.ClientCertRequest, callback: (Result) -> Unit) -{ + fun onReceivedClientCertRequest( + pigeon_instanceArg: android.webkit.WebViewClient, + viewArg: android.webkit.WebView, + requestArg: android.webkit.ClientCertRequest, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4483,27 +3390,35 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedClientCertRequest" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedClientCertRequest" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, viewArg, requestArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that a request to automatically log in the - * user has been processed. + * Notify the host application that a request to automatically log in the user has been processed. */ - fun onReceivedLoginRequest(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, realmArg: String, accountArg: String?, argsArg: String, callback: (Result) -> Unit) -{ + fun onReceivedLoginRequest( + pigeon_instanceArg: android.webkit.WebViewClient, + viewArg: android.webkit.WebView, + realmArg: String, + accountArg: String?, + argsArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4512,27 +3427,32 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedLoginRequest" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebViewClient.onReceivedLoginRequest" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, viewArg, realmArg, accountArg, argsArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } - /** - * Notifies the host application that an SSL error occurred while loading a - * resource. - */ - fun onReceivedSslError(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, handlerArg: android.webkit.SslErrorHandler, errorArg: android.net.http.SslError, callback: (Result) -> Unit) -{ + /** Notifies the host application that an SSL error occurred while loading a resource. */ + fun onReceivedSslError( + pigeon_instanceArg: android.webkit.WebViewClient, + viewArg: android.webkit.WebView, + handlerArg: android.webkit.SslErrorHandler, + errorArg: android.net.http.SslError, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4546,22 +3466,26 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, viewArg, handlerArg, errorArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } - /** - * Notify the host application that the scale applied to the WebView has - * changed. - */ - fun onScaleChanged(pigeon_instanceArg: android.webkit.WebViewClient, viewArg: android.webkit.WebView, oldScaleArg: Double, newScaleArg: Double, callback: (Result) -> Unit) -{ + /** Notify the host application that the scale applied to the WebView has changed. */ + fun onScaleChanged( + pigeon_instanceArg: android.webkit.WebViewClient, + viewArg: android.webkit.WebView, + oldScaleArg: Double, + newScaleArg: Double, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -4575,433 +3499,27 @@ abstract class PigeonApiWebViewClient(open val pigeonRegistrar: AndroidWebkitLib channel.send(listOf(pigeon_instanceArg, viewArg, oldScaleArg, newScaleArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } - } - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebViewClient; -import android.webkit.WebView; -import android.webkit.WebResourceRequest; -import android.webkit.WebResourceResponse; -import android.webkit.WebResourceError; -import androidx.webkit.WebResourceErrorCompat; -import android.webkit.HttpAuthHandler; -import android.os.Message; -import android.webkit.ClientCertRequest; -import android.webkit.SslErrorHandler; -import android.net.http.SslError; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebViewClient}. - * 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 WebViewClientProxyApi extends PigeonApiWebViewClient { - WebViewClientProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - /** Implementation of {@link WebViewClient} that passes arguments of callback methods to Dart. */ - static class WebViewClientImpl extends WebViewClient { - private final WebViewClientProxyApi api; - WebViewClientImpl(@NonNull WebViewClientProxyApi api) { - this.api = api; - } - @Override - public void onPageStarted(@NonNull android.webkit.WebView webView, @NonNull String url) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onPageStarted(this, webView, url, reply -> null)); - } - @Override - public void onPageFinished(@NonNull android.webkit.WebView webView, @NonNull String url) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onPageFinished(this, webView, url, reply -> null)); - } - @Override - public void onReceivedHttpError(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebResourceRequest request, @NonNull android.webkit.WebResourceResponse response) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedHttpError(this, webView, request, response, reply -> null)); - } - @Override - public void onReceivedRequestError(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebResourceRequest request, @NonNull android.webkit.WebResourceError error) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedRequestError(this, webView, request, error, reply -> null)); - } - @Override - public void onReceivedRequestErrorCompat(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebResourceRequest request, @NonNull androidx.webkit.WebResourceErrorCompat error) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedRequestErrorCompat(this, webView, request, error, reply -> null)); - } - @Override - public void onReceivedError(@NonNull android.webkit.WebView webView, @NonNull Long errorCode, @NonNull String description, @NonNull String failingUrl) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedError(this, webView, errorCode, description, failingUrl, reply -> null)); - } - @Override - public void requestLoading(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebResourceRequest request) { - api.getPigeonRegistrar().runOnMainThread(() -> api.requestLoading(this, webView, request, reply -> null)); - } - @Override - public void urlLoading(@NonNull android.webkit.WebView webView, @NonNull String url) { - api.getPigeonRegistrar().runOnMainThread(() -> api.urlLoading(this, webView, url, reply -> null)); - } - @Override - public void doUpdateVisitedHistory(@NonNull android.webkit.WebView webView, @NonNull String url, @NonNull Boolean isReload) { - api.getPigeonRegistrar().runOnMainThread(() -> api.doUpdateVisitedHistory(this, webView, url, isReload, reply -> null)); - } - @Override - public void onReceivedHttpAuthRequest(@NonNull android.webkit.WebView webView, @NonNull android.webkit.HttpAuthHandler handler, @NonNull String host, @NonNull String realm) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedHttpAuthRequest(this, webView, handler, host, realm, reply -> null)); - } - @Override - public void onFormResubmission(@NonNull android.webkit.WebView view, @NonNull android.os.Message dontResend, @NonNull android.os.Message resend) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onFormResubmission(this, view, dontResend, resend, reply -> null)); - } - @Override - public void onLoadResource(@NonNull android.webkit.WebView view, @NonNull String url) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onLoadResource(this, view, url, reply -> null)); - } - @Override - public void onPageCommitVisible(@NonNull android.webkit.WebView view, @NonNull String url) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onPageCommitVisible(this, view, url, reply -> null)); - } - @Override - public void onReceivedClientCertRequest(@NonNull android.webkit.WebView view, @NonNull android.webkit.ClientCertRequest request) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedClientCertRequest(this, view, request, reply -> null)); - } - @Override - public void onReceivedLoginRequest(@NonNull android.webkit.WebView view, @NonNull String realm, @Nullable String? account, @NonNull String args) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedLoginRequest(this, view, realm, account, args, reply -> null)); - } - @Override - public void onReceivedSslError(@NonNull android.webkit.WebView view, @NonNull android.webkit.SslErrorHandler handler, @NonNull android.net.http.SslError error) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onReceivedSslError(this, view, handler, error, reply -> null)); - } - @Override - public void onScaleChanged(@NonNull android.webkit.WebView view, @NonNull Double oldScale, @NonNull Double newScale) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onScaleChanged(this, view, oldScale, newScale, reply -> null)); - } - } - - @NonNull - @Override - public WebViewClient pigeon_defaultConstructor() { - return WebViewClientImpl(); - } - - @Override - public void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull WebViewClient pigeon_instance,@NonNull Boolean value) { - pigeon_instance.setSynchronousReturnValueForShouldOverrideUrlLoading(value); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebViewClient; -import android.webkit.WebView; -import android.webkit.WebResourceRequest; -import android.webkit.WebResourceResponse; -import android.webkit.WebResourceError; -import androidx.webkit.WebResourceErrorCompat; -import android.webkit.HttpAuthHandler; -import android.os.Message; -import android.webkit.ClientCertRequest; -import android.webkit.SslErrorHandler; -import android.net.http.SslError; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebViewClientTest { - @Test - public void pigeon_defaultConstructor() { - final PigeonApiWebViewClient api = new TestProxyApiRegistrar().getPigeonApiWebViewClient(); - - assertTrue(api.pigeon_defaultConstructor() instanceof WebViewClientProxyApi.WebViewClient); - } - - @Test - public void setSynchronousReturnValueForShouldOverrideUrlLoading() { - final PigeonApiWebViewClient api = new TestProxyApiRegistrar().getPigeonApiWebViewClient(); - - final WebViewClient instance = mock(WebViewClient.class); - final Boolean value = true; - api.setSynchronousReturnValueForShouldOverrideUrlLoading(instance, value); - - verify(instance).setSynchronousReturnValueForShouldOverrideUrlLoading(value); - } - - @Test - public void onPageStarted() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final String url = "myString"; - instance.onPageStarted(webView, url); - - verify(mockApi).onPageStarted(eq(instance), eq(webView), eq(url), any()); - } - - @Test - public void onPageFinished() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final String url = "myString"; - instance.onPageFinished(webView, url); - - verify(mockApi).onPageFinished(eq(instance), eq(webView), eq(url), any()); - } - - @Test - public void onReceivedHttpError() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final android.webkit.WebResourceRequest request = mock(WebResourceRequest.class); - final android.webkit.WebResourceResponse response = mock(WebResourceResponse.class); - instance.onReceivedHttpError(webView, request, response); - - verify(mockApi).onReceivedHttpError(eq(instance), eq(webView), eq(request), eq(response), any()); - } - - @Test - public void onReceivedRequestError() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final android.webkit.WebResourceRequest request = mock(WebResourceRequest.class); - final android.webkit.WebResourceError error = mock(WebResourceError.class); - instance.onReceivedRequestError(webView, request, error); - - verify(mockApi).onReceivedRequestError(eq(instance), eq(webView), eq(request), eq(error), any()); - } - - @Test - public void onReceivedRequestErrorCompat() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final android.webkit.WebResourceRequest request = mock(WebResourceRequest.class); - final androidx.webkit.WebResourceErrorCompat error = mock(WebResourceErrorCompat.class); - instance.onReceivedRequestErrorCompat(webView, request, error); - - verify(mockApi).onReceivedRequestErrorCompat(eq(instance), eq(webView), eq(request), eq(error), any()); - } - - @Test - public void onReceivedError() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final Long errorCode = 0; - final String description = "myString"; - final String failingUrl = "myString"; - instance.onReceivedError(webView, errorCode, description, failingUrl); - - verify(mockApi).onReceivedError(eq(instance), eq(webView), eq(errorCode), eq(description), eq(failingUrl), any()); - } - - @Test - public void requestLoading() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final android.webkit.WebResourceRequest request = mock(WebResourceRequest.class); - instance.requestLoading(webView, request); - - verify(mockApi).requestLoading(eq(instance), eq(webView), eq(request), any()); - } - - @Test - public void urlLoading() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final String url = "myString"; - instance.urlLoading(webView, url); - - verify(mockApi).urlLoading(eq(instance), eq(webView), eq(url), any()); - } - - @Test - public void doUpdateVisitedHistory() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final String url = "myString"; - final Boolean isReload = true; - instance.doUpdateVisitedHistory(webView, url, isReload); - - verify(mockApi).doUpdateVisitedHistory(eq(instance), eq(webView), eq(url), eq(isReload), any()); - } - - @Test - public void onReceivedHttpAuthRequest() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final android.webkit.HttpAuthHandler handler = mock(HttpAuthHandler.class); - final String host = "myString"; - final String realm = "myString"; - instance.onReceivedHttpAuthRequest(webView, handler, host, realm); - - verify(mockApi).onReceivedHttpAuthRequest(eq(instance), eq(webView), eq(handler), eq(host), eq(realm), any()); - } - - @Test - public void onFormResubmission() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView view = mock(WebView.class); - final android.os.Message dontResend = mock(AndroidMessage.class); - final android.os.Message resend = mock(AndroidMessage.class); - instance.onFormResubmission(view, dontResend, resend); - - verify(mockApi).onFormResubmission(eq(instance), eq(view), eq(dontResend), eq(resend), any()); - } - - @Test - public void onLoadResource() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView view = mock(WebView.class); - final String url = "myString"; - instance.onLoadResource(view, url); - - verify(mockApi).onLoadResource(eq(instance), eq(view), eq(url), any()); - } - - @Test - public void onPageCommitVisible() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView view = mock(WebView.class); - final String url = "myString"; - instance.onPageCommitVisible(view, url); - - verify(mockApi).onPageCommitVisible(eq(instance), eq(view), eq(url), any()); - } - - @Test - public void onReceivedClientCertRequest() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView view = mock(WebView.class); - final android.webkit.ClientCertRequest request = mock(ClientCertRequest.class); - instance.onReceivedClientCertRequest(view, request); - - verify(mockApi).onReceivedClientCertRequest(eq(instance), eq(view), eq(request), any()); - } - - @Test - public void onReceivedLoginRequest() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView view = mock(WebView.class); - final String realm = "myString"; - final String account = "myString"; - final String args = "myString"; - instance.onReceivedLoginRequest(view, realm, account, args); - - verify(mockApi).onReceivedLoginRequest(eq(instance), eq(view), eq(realm), eq(account), eq(args), any()); - } - - @Test - public void onReceivedSslError() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView view = mock(WebView.class); - final android.webkit.SslErrorHandler handler = mock(SslErrorHandler.class); - final android.net.http.SslError error = mock(SslError.class); - instance.onReceivedSslError(view, handler, error); - - verify(mockApi).onReceivedSslError(eq(instance), eq(view), eq(handler), eq(error), any()); - } - - @Test - public void onScaleChanged() { - final WebViewClientProxyApi mockApi = mock(WebViewClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebViewClientImpl instance = new WebViewClientImpl(mockApi); - final android.webkit.WebView view = mock(WebView.class); - final Double oldScale = 1.0; - final Double newScale = 1.0; - instance.onScaleChanged(view, oldScale, newScale); - - verify(mockApi).onScaleChanged(eq(instance), eq(view), eq(oldScale), eq(newScale), any()); - } - -} -*/ /** * Handles notifications that a file should be downloaded. * * See https://developer.android.com/reference/android/webkit/DownloadListener. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiDownloadListener(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiDownloadListener( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun pigeon_defaultConstructor(): android.webkit.DownloadListener companion object { @@ -5009,17 +3527,23 @@ abstract class PigeonApiDownloadListener(open val pigeonRegistrar: AndroidWebkit fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiDownloadListener?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.DownloadListener.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.DownloadListener.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5031,24 +3555,36 @@ abstract class PigeonApiDownloadListener(open val pigeonRegistrar: AndroidWebkit @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of DownloadListener and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.DownloadListener, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.DownloadListener, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - AndroidWebKitError("new-instance-error", "Attempting to create a new Dart instance of DownloadListener, but the class has a nonnull callback method.", ""))) + AndroidWebKitError( + "new-instance-error", + "Attempting to create a new Dart instance of DownloadListener, but the class has a nonnull callback method.", + ""))) } } /** Notify the host application that a file should be downloaded. */ - fun onDownloadStart(pigeon_instanceArg: android.webkit.DownloadListener, urlArg: String, userAgentArg: String, contentDispositionArg: String, mimetypeArg: String, contentLengthArg: Long, callback: (Result) -> Unit) -{ + fun onDownloadStart( + pigeon_instanceArg: android.webkit.DownloadListener, + urlArg: String, + userAgentArg: String, + contentDispositionArg: String, + mimetypeArg: String, + contentLengthArg: Long, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5059,224 +3595,161 @@ abstract class PigeonApiDownloadListener(open val pigeonRegistrar: AndroidWebkit val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.DownloadListener.onDownloadStart" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_instanceArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } - } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.DownloadListener; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link DownloadListener}. - * 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 DownloadListenerProxyApi extends PigeonApiDownloadListener { - DownloadListenerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - /** Implementation of {@link DownloadListener} that passes arguments of callback methods to Dart. */ - static class DownloadListenerImpl extends DownloadListener { - private final DownloadListenerProxyApi api; - DownloadListenerImpl(@NonNull DownloadListenerProxyApi api) { - this.api = api; - } - @Override - public void onDownloadStart(@NonNull String url, @NonNull String userAgent, @NonNull String contentDisposition, @NonNull String mimetype, @NonNull Long contentLength) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onDownloadStart(this, url, userAgent, contentDisposition, mimetype, contentLength, reply -> null)); - } - } - - @NonNull - @Override - public DownloadListener pigeon_defaultConstructor() { - return DownloadListenerImpl(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.DownloadListener; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class DownloadListenerTest { - @Test - public void pigeon_defaultConstructor() { - final PigeonApiDownloadListener api = new TestProxyApiRegistrar().getPigeonApiDownloadListener(); - - assertTrue(api.pigeon_defaultConstructor() instanceof DownloadListenerProxyApi.DownloadListenerImpl); - } - - @Test - public void onDownloadStart() { - final DownloadListenerProxyApi mockApi = mock(DownloadListenerProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final DownloadListenerImpl instance = new DownloadListenerImpl(mockApi); - final String url = "myString"; - final String userAgent = "myString"; - final String contentDisposition = "myString"; - final String mimetype = "myString"; - final Long contentLength = 0; - instance.onDownloadStart(url, userAgent, contentDisposition, mimetype, contentLength); - - verify(mockApi).onDownloadStart(eq(instance), eq(url), eq(userAgent), eq(contentDisposition), eq(mimetype), eq(contentLength), any()); + channel.send( + listOf( + pigeon_instanceArg, + urlArg, + userAgentArg, + contentDispositionArg, + mimetypeArg, + contentLengthArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } } - } -*/ /** - * Handles notification of JavaScript dialogs, favicons, titles, and the - * progress. + * Handles notification of JavaScript dialogs, favicons, titles, and the progress. * * See https://developer.android.com/reference/android/webkit/WebChromeClient. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { - abstract fun pigeon_defaultConstructor(): io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl +abstract class PigeonApiWebChromeClient( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { + abstract fun pigeon_defaultConstructor(): + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onShowFileChooser(...)`. * - * The Java method, `WebChromeClient.onShowFileChooser(...)`, requires - * a boolean to be returned and this method sets the returned value for all - * calls to the Java method. + * The Java method, `WebChromeClient.onShowFileChooser(...)`, requires a boolean to be returned + * and this method sets the returned value for all calls to the Java method. * - * Setting this to true indicates that all file chooser requests should be - * handled by `onShowFileChooser` and the returned list of Strings will be - * returned to the WebView. Otherwise, the client will use the default - * handling and the returned value in `onShowFileChooser` will be ignored. + * Setting this to true indicates that all file chooser requests should be handled by + * `onShowFileChooser` and the returned list of Strings will be returned to the WebView. + * Otherwise, the client will use the default handling and the returned value in + * `onShowFileChooser` will be ignored. * * Requires `onShowFileChooser` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnShowFileChooser(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) + abstract fun setSynchronousReturnValueForOnShowFileChooser( + pigeon_instance: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + value: Boolean + ) /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onConsoleMessage(...)`. * - * The Java method, `WebChromeClient.onConsoleMessage(...)`, requires - * a boolean to be returned and this method sets the returned value for all - * calls to the Java method. + * The Java method, `WebChromeClient.onConsoleMessage(...)`, requires a boolean to be returned and + * this method sets the returned value for all calls to the Java method. * - * Setting this to true indicates that the client is handling all console - * messages. + * Setting this to true indicates that the client is handling all console messages. * * Requires `onConsoleMessage` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnConsoleMessage(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) + abstract fun setSynchronousReturnValueForOnConsoleMessage( + pigeon_instance: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + value: Boolean + ) /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onJsAlert(...)`. * - * The Java method, `WebChromeClient.onJsAlert(...)`, requires a boolean to - * be returned and this method sets the returned value for all calls to the - * Java method. + * The Java method, `WebChromeClient.onJsAlert(...)`, requires a boolean to be returned and this + * method sets the returned value for all calls to the Java method. * - * Setting this to true indicates that the client is handling all console - * messages. + * Setting this to true indicates that the client is handling all console messages. * * Requires `onJsAlert` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnJsAlert(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) + abstract fun setSynchronousReturnValueForOnJsAlert( + pigeon_instance: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + value: Boolean + ) /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onJsConfirm(...)`. * - * The Java method, `WebChromeClient.onJsConfirm(...)`, requires a boolean to - * be returned and this method sets the returned value for all calls to the - * Java method. + * The Java method, `WebChromeClient.onJsConfirm(...)`, requires a boolean to be returned and this + * method sets the returned value for all calls to the Java method. * - * Setting this to true indicates that the client is handling all console - * messages. + * Setting this to true indicates that the client is handling all console messages. * * Requires `onJsConfirm` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnJsConfirm(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) + abstract fun setSynchronousReturnValueForOnJsConfirm( + pigeon_instance: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + value: Boolean + ) /** * Sets the required synchronous return value for the Java method, * `WebChromeClient.onJsPrompt(...)`. * - * The Java method, `WebChromeClient.onJsPrompt(...)`, requires a boolean to - * be returned and this method sets the returned value for all calls to the - * Java method. + * The Java method, `WebChromeClient.onJsPrompt(...)`, requires a boolean to be returned and this + * method sets the returned value for all calls to the Java method. * - * Setting this to true indicates that the client is handling all console - * messages. + * Setting this to true indicates that the client is handling all console messages. * * Requires `onJsPrompt` to be nonnull. * * Defaults to false. */ - abstract fun setSynchronousReturnValueForOnJsPrompt(pigeon_instance: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, value: Boolean) + abstract fun setSynchronousReturnValueForOnJsPrompt( + pigeon_instance: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + value: Boolean + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebChromeClient?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.pigeon_defaultConstructor", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.pigeon_defaultConstructor", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.pigeon_defaultConstructor(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.pigeon_defaultConstructor(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5284,18 +3757,25 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnShowFileChooser", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnShowFileChooser", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = + args[0] + as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = try { - api.setSynchronousReturnValueForOnShowFileChooser(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSynchronousReturnValueForOnShowFileChooser(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5303,18 +3783,25 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnConsoleMessage", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnConsoleMessage", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = + args[0] + as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = try { - api.setSynchronousReturnValueForOnConsoleMessage(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSynchronousReturnValueForOnConsoleMessage(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5322,18 +3809,25 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsAlert", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsAlert", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = + args[0] + as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = try { - api.setSynchronousReturnValueForOnJsAlert(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSynchronousReturnValueForOnJsAlert(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5341,18 +3835,25 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsConfirm", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsConfirm", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = + args[0] + as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = try { - api.setSynchronousReturnValueForOnJsConfirm(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSynchronousReturnValueForOnJsConfirm(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5360,18 +3861,25 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsPrompt", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.setSynchronousReturnValueForOnJsPrompt", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl + val pigeon_instanceArg = + args[0] + as io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl val valueArg = args[1] as Boolean - val wrapped: List = try { - api.setSynchronousReturnValueForOnJsPrompt(pigeon_instanceArg, valueArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setSynchronousReturnValueForOnJsPrompt(pigeon_instanceArg, valueArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -5383,24 +3891,35 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebChromeClient and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { + } else { callback( Result.failure( - AndroidWebKitError("new-instance-error", "Attempting to create a new Dart instance of WebChromeClient, but the class has a nonnull callback method.", ""))) + AndroidWebKitError( + "new-instance-error", + "Attempting to create a new Dart instance of WebChromeClient, but the class has a nonnull callback method.", + ""))) } } /** Tell the host application the current progress of loading a page. */ - fun onProgressChanged(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, progressArg: Long, callback: (Result) -> Unit) -{ + fun onProgressChanged( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + webViewArg: android.webkit.WebView, + progressArg: Long, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5414,19 +3933,26 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL channel.send(listOf(pigeon_instanceArg, webViewArg, progressArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Tell the client to show a file chooser. */ - fun onShowFileChooser(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, paramsArg: android.webkit.WebChromeClient.FileChooserParams, callback: (Result>) -> Unit) -{ + fun onShowFileChooser( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + webViewArg: android.webkit.WebView, + paramsArg: android.webkit.WebChromeClient.FileChooserParams, + callback: (Result>) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5440,26 +3966,36 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL channel.send(listOf(pigeon_instanceArg, webViewArg, paramsArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else if (it[0] == null) { - callback(Result.failure(AndroidWebKitError("null-error", "Flutter api returned null value for non-null return value.", ""))) + callback( + Result.failure( + AndroidWebKitError( + "null-error", + "Flutter api returned null value for non-null return value.", + ""))) } else { val output = it[0] as List callback(Result.success(output)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that web content is requesting permission to - * access the specified resources and the permission currently isn't granted - * or denied. + * Notify the host application that web content is requesting permission to access the specified + * resources and the permission currently isn't granted or denied. */ - fun onPermissionRequest(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, requestArg: android.webkit.PermissionRequest, callback: (Result) -> Unit) -{ + fun onPermissionRequest( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + requestArg: android.webkit.PermissionRequest, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5468,24 +4004,32 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onPermissionRequest" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onPermissionRequest" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, requestArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Callback to Dart function `WebChromeClient.onShowCustomView`. */ - fun onShowCustomView(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, viewArg: android.view.View, callbackArg: android.webkit.WebChromeClient.CustomViewCallback, callback: (Result) -> Unit) -{ + fun onShowCustomView( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + viewArg: android.view.View, + callbackArg: android.webkit.WebChromeClient.CustomViewCallback, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5499,22 +4043,24 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL channel.send(listOf(pigeon_instanceArg, viewArg, callbackArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } - /** - * Notify the host application that the current page has entered full screen - * mode. - */ - fun onHideCustomView(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, callback: (Result) -> Unit) -{ + /** Notify the host application that the current page has entered full screen mode. */ + fun onHideCustomView( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5528,23 +4074,29 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL channel.send(listOf(pigeon_instanceArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that web content from the specified origin is - * attempting to use the Geolocation API, but no permission state is - * currently set for that origin. + * Notify the host application that web content from the specified origin is attempting to use the + * Geolocation API, but no permission state is currently set for that origin. */ - fun onGeolocationPermissionsShowPrompt(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, originArg: String, callbackArg: android.webkit.GeolocationPermissions.Callback, callback: (Result) -> Unit) -{ + fun onGeolocationPermissionsShowPrompt( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + originArg: String, + callbackArg: android.webkit.GeolocationPermissions.Callback, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5553,28 +4105,33 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onGeolocationPermissionsShowPrompt" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onGeolocationPermissionsShowPrompt" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg, originArg, callbackArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that a request for Geolocation permissions, - * made with a previous call to `onGeolocationPermissionsShowPrompt` has been - * canceled. + * Notify the host application that a request for Geolocation permissions, made with a previous + * call to `onGeolocationPermissionsShowPrompt` has been canceled. */ - fun onGeolocationPermissionsHidePrompt(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, callback: (Result) -> Unit) -{ + fun onGeolocationPermissionsHidePrompt( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5583,24 +4140,31 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL } val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onGeolocationPermissionsHidePrompt" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.WebChromeClient.onGeolocationPermissionsHidePrompt" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_instanceArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** Report a JavaScript console message to the host application. */ - fun onConsoleMessage(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, messageArg: android.webkit.ConsoleMessage, callback: (Result) -> Unit) -{ + fun onConsoleMessage( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + messageArg: android.webkit.ConsoleMessage, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5614,22 +4178,29 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL channel.send(listOf(pigeon_instanceArg, messageArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that the web page wants to display a - * JavaScript `alert()` dialog. + * Notify the host application that the web page wants to display a JavaScript `alert()` dialog. */ - fun onJsAlert(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, urlArg: String, messageArg: String, callback: (Result) -> Unit) -{ + fun onJsAlert( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + webViewArg: android.webkit.WebView, + urlArg: String, + messageArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5643,22 +4214,29 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, messageArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that the web page wants to display a - * JavaScript `confirm()` dialog. + * Notify the host application that the web page wants to display a JavaScript `confirm()` dialog. */ - fun onJsConfirm(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, urlArg: String, messageArg: String, callback: (Result) -> Unit) -{ + fun onJsConfirm( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + webViewArg: android.webkit.WebView, + urlArg: String, + messageArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5672,25 +4250,38 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, messageArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else if (it[0] == null) { - callback(Result.failure(AndroidWebKitError("null-error", "Flutter api returned null value for non-null return value.", ""))) + callback( + Result.failure( + AndroidWebKitError( + "null-error", + "Flutter api returned null value for non-null return value.", + ""))) } else { val output = it[0] as Boolean callback(Result.success(output)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + } } } /** - * Notify the host application that the web page wants to display a - * JavaScript `prompt()` dialog. + * Notify the host application that the web page wants to display a JavaScript `prompt()` dialog. */ - fun onJsPrompt(pigeon_instanceArg: io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, webViewArg: android.webkit.WebView, urlArg: String, messageArg: String, defaultValueArg: String, callback: (Result) -> Unit) -{ + fun onJsPrompt( + pigeon_instanceArg: + io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl, + webViewArg: android.webkit.WebView, + urlArg: String, + messageArg: String, + defaultValueArg: String, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( @@ -5704,375 +4295,28 @@ abstract class PigeonApiWebChromeClient(open val pigeonRegistrar: AndroidWebkitL channel.send(listOf(pigeon_instanceArg, webViewArg, urlArg, messageArg, defaultValueArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { val output = it[0] as String? callback(Result.success(output)) } } else { callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } - } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl; -import android.webkit.WebView; -import android.webkit.WebChromeClient.FileChooserParams; -import android.webkit.PermissionRequest; -import android.view.View; -import android.webkit.WebChromeClient.CustomViewCallback; -import android.webkit.GeolocationPermissions.Callback; -import android.webkit.ConsoleMessage; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebChromeClient}. - * 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 WebChromeClientProxyApi extends PigeonApiWebChromeClient { - WebChromeClientProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - /** Implementation of {@link WebChromeClient} that passes arguments of callback methods to Dart. */ - static class WebChromeClientImpl extends WebChromeClient { - private final WebChromeClientProxyApi api; - WebChromeClientImpl(@NonNull WebChromeClientProxyApi api) { - this.api = api; - } - @Override - public void onProgressChanged(@NonNull android.webkit.WebView webView, @NonNull Long progress) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onProgressChanged(this, webView, progress, reply -> null)); - } - @Override - public void onShowFileChooser(@NonNull android.webkit.WebView webView, @NonNull android.webkit.WebChromeClient.FileChooserParams params) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onShowFileChooser(this, webView, params, reply -> null)); - } - @Override - public void onPermissionRequest(@NonNull android.webkit.PermissionRequest request) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onPermissionRequest(this, request, reply -> null)); - } - @Override - public void onShowCustomView(@NonNull android.view.View view, @NonNull android.webkit.WebChromeClient.CustomViewCallback callback) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onShowCustomView(this, view, callback, reply -> null)); - } - @Override - public void onHideCustomView() { - api.getPigeonRegistrar().runOnMainThread(() -> api.onHideCustomView(this , reply -> null)); - } - @Override - public void onGeolocationPermissionsShowPrompt(@NonNull String origin, @NonNull android.webkit.GeolocationPermissions.Callback callback) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onGeolocationPermissionsShowPrompt(this, origin, callback, reply -> null)); - } - @Override - public void onGeolocationPermissionsHidePrompt() { - api.getPigeonRegistrar().runOnMainThread(() -> api.onGeolocationPermissionsHidePrompt(this , reply -> null)); - } - @Override - public void onConsoleMessage(@NonNull android.webkit.ConsoleMessage message) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onConsoleMessage(this, message, reply -> null)); - } - @Override - public void onJsAlert(@NonNull android.webkit.WebView webView, @NonNull String url, @NonNull String message) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onJsAlert(this, webView, url, message, reply -> null)); - } - @Override - public void onJsConfirm(@NonNull android.webkit.WebView webView, @NonNull String url, @NonNull String message) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onJsConfirm(this, webView, url, message, reply -> null)); - } - @Override - public void onJsPrompt(@NonNull android.webkit.WebView webView, @NonNull String url, @NonNull String message, @NonNull String defaultValue) { - api.getPigeonRegistrar().runOnMainThread(() -> api.onJsPrompt(this, webView, url, message, defaultValue, reply -> null)); + } } } - - @NonNull - @Override - public WebChromeClient pigeon_defaultConstructor() { - return WebChromeClientImpl(); - } - - @Override - public void setSynchronousReturnValueForOnShowFileChooser(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { - pigeon_instance.setSynchronousReturnValueForOnShowFileChooser(value); - } - - @Override - public void setSynchronousReturnValueForOnConsoleMessage(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { - pigeon_instance.setSynchronousReturnValueForOnConsoleMessage(value); - } - - @Override - public void setSynchronousReturnValueForOnJsAlert(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { - pigeon_instance.setSynchronousReturnValueForOnJsAlert(value); - } - - @Override - public void setSynchronousReturnValueForOnJsConfirm(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { - pigeon_instance.setSynchronousReturnValueForOnJsConfirm(value); - } - - @Override - public void setSynchronousReturnValueForOnJsPrompt(@NonNull WebChromeClient pigeon_instance,@NonNull Boolean value) { - pigeon_instance.setSynchronousReturnValueForOnJsPrompt(value); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import io.flutter.plugins.webviewflutter.WebChromeClientProxyApi.WebChromeClientImpl; -import android.webkit.WebView; -import android.webkit.WebChromeClient.FileChooserParams; -import android.webkit.PermissionRequest; -import android.view.View; -import android.webkit.WebChromeClient.CustomViewCallback; -import android.webkit.GeolocationPermissions.Callback; -import android.webkit.ConsoleMessage; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebChromeClientTest { - @Test - public void pigeon_defaultConstructor() { - final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); - - assertTrue(api.pigeon_defaultConstructor() instanceof WebChromeClientProxyApi.WebChromeClient); - } - - @Test - public void setSynchronousReturnValueForOnShowFileChooser() { - final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); - - final WebChromeClient instance = mock(WebChromeClient.class); - final Boolean value = true; - api.setSynchronousReturnValueForOnShowFileChooser(instance, value); - - verify(instance).setSynchronousReturnValueForOnShowFileChooser(value); - } - - @Test - public void setSynchronousReturnValueForOnConsoleMessage() { - final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); - - final WebChromeClient instance = mock(WebChromeClient.class); - final Boolean value = true; - api.setSynchronousReturnValueForOnConsoleMessage(instance, value); - - verify(instance).setSynchronousReturnValueForOnConsoleMessage(value); - } - - @Test - public void setSynchronousReturnValueForOnJsAlert() { - final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); - - final WebChromeClient instance = mock(WebChromeClient.class); - final Boolean value = true; - api.setSynchronousReturnValueForOnJsAlert(instance, value); - - verify(instance).setSynchronousReturnValueForOnJsAlert(value); - } - - @Test - public void setSynchronousReturnValueForOnJsConfirm() { - final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); - - final WebChromeClient instance = mock(WebChromeClient.class); - final Boolean value = true; - api.setSynchronousReturnValueForOnJsConfirm(instance, value); - - verify(instance).setSynchronousReturnValueForOnJsConfirm(value); - } - - @Test - public void setSynchronousReturnValueForOnJsPrompt() { - final PigeonApiWebChromeClient api = new TestProxyApiRegistrar().getPigeonApiWebChromeClient(); - - final WebChromeClient instance = mock(WebChromeClient.class); - final Boolean value = true; - api.setSynchronousReturnValueForOnJsPrompt(instance, value); - - verify(instance).setSynchronousReturnValueForOnJsPrompt(value); - } - - @Test - public void onProgressChanged() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final Long progress = 0; - instance.onProgressChanged(webView, progress); - - verify(mockApi).onProgressChanged(eq(instance), eq(webView), eq(progress), any()); - } - - @Test - public void onShowFileChooser() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final android.webkit.WebChromeClient.FileChooserParams params = mock(FileChooserParams.class); - instance.onShowFileChooser(webView, params); - - verify(mockApi).onShowFileChooser(eq(instance), eq(webView), eq(params), any()); - } - - @Test - public void onPermissionRequest() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final android.webkit.PermissionRequest request = mock(PermissionRequest.class); - instance.onPermissionRequest(request); - - verify(mockApi).onPermissionRequest(eq(instance), eq(request), any()); - } - - @Test - public void onShowCustomView() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final android.view.View view = mock(View.class); - final android.webkit.WebChromeClient.CustomViewCallback callback = mock(CustomViewCallback.class); - instance.onShowCustomView(view, callback); - - verify(mockApi).onShowCustomView(eq(instance), eq(view), eq(callback), any()); - } - - @Test - public void onHideCustomView() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - instance.onHideCustomView(); - - verify(mockApi).onHideCustomView(eq(instance) , any()); - } - - @Test - public void onGeolocationPermissionsShowPrompt() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final String origin = "myString"; - final android.webkit.GeolocationPermissions.Callback callback = mock(GeolocationPermissionsCallback.class); - instance.onGeolocationPermissionsShowPrompt(origin, callback); - - verify(mockApi).onGeolocationPermissionsShowPrompt(eq(instance), eq(origin), eq(callback), any()); - } - - @Test - public void onGeolocationPermissionsHidePrompt() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - instance.onGeolocationPermissionsHidePrompt(); - - verify(mockApi).onGeolocationPermissionsHidePrompt(eq(instance) , any()); - } - - @Test - public void onConsoleMessage() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final android.webkit.ConsoleMessage message = mock(ConsoleMessage.class); - instance.onConsoleMessage(message); - - verify(mockApi).onConsoleMessage(eq(instance), eq(message), any()); - } - - @Test - public void onJsAlert() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final String url = "myString"; - final String message = "myString"; - instance.onJsAlert(webView, url, message); - - verify(mockApi).onJsAlert(eq(instance), eq(webView), eq(url), eq(message), any()); - } - - @Test - public void onJsConfirm() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final String url = "myString"; - final String message = "myString"; - instance.onJsConfirm(webView, url, message); - - verify(mockApi).onJsConfirm(eq(instance), eq(webView), eq(url), eq(message), any()); - } - - @Test - public void onJsPrompt() { - final WebChromeClientProxyApi mockApi = mock(WebChromeClientProxyApi.class); - when(mockApi.pigeonRegistrar).thenReturn(new TestProxyApiRegistrar()); - - final WebChromeClientImpl instance = new WebChromeClientImpl(mockApi); - final android.webkit.WebView webView = mock(WebView.class); - final String url = "myString"; - final String message = "myString"; - final String defaultValue = "myString"; - instance.onJsPrompt(webView, url, message, defaultValue); - - verify(mockApi).onJsPrompt(eq(instance), eq(webView), eq(url), eq(message), eq(defaultValue), any()); - } - } -*/ /** * Provides access to the assets registered as part of the App bundle. * * Convenience class for accessing Flutter asset resources. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiFlutterAssetManager(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiFlutterAssetManager( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** The global instance of the `FlutterAssetManager`. */ abstract fun instance(): io.flutter.plugins.webviewflutter.FlutterAssetManager @@ -6081,35 +4325,46 @@ abstract class PigeonApiFlutterAssetManager(open val pigeonRegistrar: AndroidWeb * * Throws an IOException in case I/O operations were interrupted. */ - abstract fun list(pigeon_instance: io.flutter.plugins.webviewflutter.FlutterAssetManager, path: String): List + abstract fun list( + pigeon_instance: io.flutter.plugins.webviewflutter.FlutterAssetManager, + path: String + ): List /** * Gets the relative file path to the Flutter asset with the given name, including the file's * extension, e.g., "myImage.jpg". * - * The returned file path is relative to the Android app's standard asset's - * directory. Therefore, the returned path is appropriate to pass to - * Android's AssetManager, but the path is not appropriate to load as an - * absolute path. + * The returned file path is relative to the Android app's standard asset's directory. Therefore, + * the returned path is appropriate to pass to Android's AssetManager, but the path is not + * appropriate to load as an absolute path. */ - abstract fun getAssetFilePathByName(pigeon_instance: io.flutter.plugins.webviewflutter.FlutterAssetManager, name: String): String + abstract fun getAssetFilePathByName( + pigeon_instance: io.flutter.plugins.webviewflutter.FlutterAssetManager, + name: String + ): String companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiFlutterAssetManager?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.instance", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.instance", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6117,17 +4372,23 @@ abstract class PigeonApiFlutterAssetManager(open val pigeonRegistrar: AndroidWeb } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.list", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.list", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.FlutterAssetManager + val pigeon_instanceArg = + args[0] as io.flutter.plugins.webviewflutter.FlutterAssetManager val pathArg = args[1] as String - val wrapped: List = try { - listOf(api.list(pigeon_instanceArg, pathArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.list(pigeon_instanceArg, pathArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6135,17 +4396,23 @@ abstract class PigeonApiFlutterAssetManager(open val pigeonRegistrar: AndroidWeb } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.getAssetFilePathByName", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.getAssetFilePathByName", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List - val pigeon_instanceArg = args[0] as io.flutter.plugins.webviewflutter.FlutterAssetManager + val pigeon_instanceArg = + args[0] as io.flutter.plugins.webviewflutter.FlutterAssetManager val nameArg = args[1] as String - val wrapped: List = try { - listOf(api.getAssetFilePathByName(pigeon_instanceArg, nameArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getAssetFilePathByName(pigeon_instanceArg, nameArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6157,136 +4424,50 @@ abstract class PigeonApiFlutterAssetManager(open val pigeonRegistrar: AndroidWeb @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of FlutterAssetManager and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: io.flutter.plugins.webviewflutter.FlutterAssetManager, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: io.flutter.plugins.webviewflutter.FlutterAssetManager, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.FlutterAssetManager.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import io.flutter.plugins.webviewflutter.FlutterAssetManager; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link FlutterAssetManager}. - * 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 FlutterAssetManagerProxyApi extends PigeonApiFlutterAssetManager { - FlutterAssetManagerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public io.flutter.plugins.webviewflutter.FlutterAssetManager instance() { - return FlutterAssetManager.getInstance(); - } - - @NonNull - @Override - public List list(@NonNull FlutterAssetManager pigeon_instance,@NonNull String path) { - return pigeon_instance.list(path); - } - - @NonNull - @Override - public String getAssetFilePathByName(@NonNull FlutterAssetManager pigeon_instance,@NonNull String name) { - return pigeon_instance.getAssetFilePathByName(name); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import io.flutter.plugins.webviewflutter.FlutterAssetManager; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class FlutterAssetManagerTest { - @Test - public void list() { - final PigeonApiFlutterAssetManager api = new TestProxyApiRegistrar().getPigeonApiFlutterAssetManager(); - - final FlutterAssetManager instance = mock(FlutterAssetManager.class); - final String path = "myString"; - final List value = Arrays.asList("myString"); - when(instance.list(path)).thenReturn(value); - - assertEquals(value, api.list(instance, path)); - } - - @Test - public void getAssetFilePathByName() { - final PigeonApiFlutterAssetManager api = new TestProxyApiRegistrar().getPigeonApiFlutterAssetManager(); - - final FlutterAssetManager instance = mock(FlutterAssetManager.class); - final String name = "myString"; - final String value = "myString"; - when(instance.getAssetFilePathByName(name)).thenReturn(value); - - assertEquals(value, api.getAssetFilePathByName(instance, name)); - } - } -*/ /** - * This class is used to manage the JavaScript storage APIs provided by the - * WebView. + * This class is used to manage the JavaScript storage APIs provided by the WebView. * * See https://developer.android.com/reference/android/webkit/WebStorage. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiWebStorage(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiWebStorage( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun instance(): android.webkit.WebStorage /** Clears all storage currently being used by the JavaScript storage APIs. */ @@ -6297,17 +4478,23 @@ abstract class PigeonApiWebStorage(open val pigeonRegistrar: AndroidWebkitLibrar fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiWebStorage?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebStorage.instance", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebStorage.instance", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_identifierArg = args[0] as Long - val wrapped: List = try { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(api.instance(), pigeon_identifierArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + api.instance(), pigeon_identifierArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6315,17 +4502,22 @@ abstract class PigeonApiWebStorage(open val pigeonRegistrar: AndroidWebkitLibrar } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.WebStorage.deleteAllData", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.WebStorage.deleteAllData", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebStorage - val wrapped: List = try { - api.deleteAllData(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.deleteAllData(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6337,16 +4529,19 @@ abstract class PigeonApiWebStorage(open val pigeonRegistrar: AndroidWebkitLibrar @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of WebStorage and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebStorage, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebStorage, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.WebStorage.pigeon_newInstance" @@ -6354,282 +4549,110 @@ abstract class PigeonApiWebStorage(open val pigeonRegistrar: AndroidWebkitLibrar channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) - } else { - callback(Result.success(Unit)) - } - } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } - } - } - } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebStorage; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link WebStorage}. - * 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 WebStorageProxyApi extends PigeonApiWebStorage { - WebStorageProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public android.webkit.WebStorage instance() { - return WebStorage.getInstance(); - } - - @Override - public void deleteAllData(@NonNull WebStorage pigeon_instance) { - pigeon_instance.deleteAllData(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebStorage; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class WebStorageTest { - @Test - public void deleteAllData() { - final PigeonApiWebStorage api = new TestProxyApiRegistrar().getPigeonApiWebStorage(); - - final WebStorage instance = mock(WebStorage.class); - api.deleteAllData(instance ); - - verify(instance).deleteAllData(); - } - -} -*/ -/** - * Parameters used in the `WebChromeClient.onShowFileChooser` method. - * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. - */ -@Suppress("UNCHECKED_CAST") -abstract class PigeonApiFileChooserParams(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { - /** Preference for a live media captured value (e.g. Camera, Microphone). */ - abstract fun isCaptureEnabled(pigeon_instance: android.webkit.WebChromeClient.FileChooserParams): Boolean - - /** An array of acceptable MIME types. */ - abstract fun acceptTypes(pigeon_instance: android.webkit.WebChromeClient.FileChooserParams): List - - /** File chooser mode. */ - abstract fun mode(pigeon_instance: android.webkit.WebChromeClient.FileChooserParams): FileChooserMode - - /** File name of a default selection if specified, or null. */ - abstract fun filenameHint(pigeon_instance: android.webkit.WebChromeClient.FileChooserParams): String? - - @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of FileChooserParams and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebChromeClient.FileChooserParams, callback: (Result) -> Unit) -{ - if (pigeonRegistrar.ignoreCallsToDart) { - callback( - Result.failure( - AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { - callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) - val isCaptureEnabledArg = isCaptureEnabled(pigeon_instanceArg) - val acceptTypesArg = acceptTypes(pigeon_instanceArg) - val modeArg = mode(pigeon_instanceArg) - val filenameHintArg = filenameHint(pigeon_instanceArg) - val binaryMessenger = pigeonRegistrar.binaryMessenger - val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.FileChooserParams.pigeon_newInstance" - val channel = BasicMessageChannel(binaryMessenger, channelName, codec) - channel.send(listOf(pigeon_identifierArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)) { - if (it is List<*>) { - if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } - } - } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebChromeClient.FileChooserParams; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link FileChooserParams}. - * 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 FileChooserParamsProxyApi extends PigeonApiFileChooserParams { - FileChooserParamsProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public Boolean isCaptureEnabled(FileChooserParams pigeon_instance) { - return pigeon_instance.getIsCaptureEnabled(); - } - - @NonNull - @Override - public List acceptTypes(FileChooserParams pigeon_instance) { - return pigeon_instance.getAcceptTypes(); - } - - @NonNull - @Override - public FileChooserMode mode(FileChooserParams pigeon_instance) { - switch (pigeon_instance.mode) { - case FileChooserMode.OPEN: return io.flutter.plugins.webviewflutter.FileChooserMode.OPEN; - case FileChooserMode.OPEN_MULTIPLE: return io.flutter.plugins.webviewflutter.FileChooserMode.OPEN_MULTIPLE; - case FileChooserMode.SAVE: return io.flutter.plugins.webviewflutter.FileChooserMode.SAVE; - default: return io.flutter.plugins.webviewflutter.FileChooserMode.UNKNOWN; - } - } - - @Nullable - @Override - public String? filenameHint(FileChooserParams pigeon_instance) { - return pigeon_instance.getFilenameHint(); + } } - } -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebChromeClient.FileChooserParams; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class FileChooserParamsTest { - @Test - public void isCaptureEnabled() { - final PigeonApiFileChooserParams api = new TestProxyApiRegistrar().getPigeonApiFileChooserParams(); - - final FileChooserParams instance = mock(FileChooserParams.class); - final Boolean value = true; - when(instance.getIsCaptureEnabled()).thenReturn(value); - - assertEquals(value, api.isCaptureEnabled(instance)); - } - - @Test - public void acceptTypes() { - final PigeonApiFileChooserParams api = new TestProxyApiRegistrar().getPigeonApiFileChooserParams(); - - final FileChooserParams instance = mock(FileChooserParams.class); - final List value = Arrays.asList("myString"); - when(instance.getAcceptTypes()).thenReturn(value); - - assertEquals(value, api.acceptTypes(instance)); - } - - @Test - public void mode() { - final PigeonApiFileChooserParams api = new TestProxyApiRegistrar().getPigeonApiFileChooserParams(); - - final FileChooserParams instance = mock(FileChooserParams.class); - final FileChooserMode value = io.flutter.plugins.webviewflutter.FileChooserMode.OPEN; - when(instance.getMode()).thenReturn(value); +/** + * Parameters used in the `WebChromeClient.onShowFileChooser` method. + * + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + */ +@Suppress("UNCHECKED_CAST") +abstract class PigeonApiFileChooserParams( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { + /** Preference for a live media captured value (e.g. Camera, Microphone). */ + abstract fun isCaptureEnabled( + pigeon_instance: android.webkit.WebChromeClient.FileChooserParams + ): Boolean - assertEquals(value, api.mode(instance)); - } + /** An array of acceptable MIME types. */ + abstract fun acceptTypes( + pigeon_instance: android.webkit.WebChromeClient.FileChooserParams + ): List - @Test - public void filenameHint() { - final PigeonApiFileChooserParams api = new TestProxyApiRegistrar().getPigeonApiFileChooserParams(); + /** File chooser mode. */ + abstract fun mode( + pigeon_instance: android.webkit.WebChromeClient.FileChooserParams + ): FileChooserMode - final FileChooserParams instance = mock(FileChooserParams.class); - final String value = "myString"; - when(instance.getFilenameHint()).thenReturn(value); + /** File name of a default selection if specified, or null. */ + abstract fun filenameHint( + pigeon_instance: android.webkit.WebChromeClient.FileChooserParams + ): String? - assertEquals(value, api.filenameHint(instance)); + @Suppress("LocalVariableName", "FunctionName") + /** Creates a Dart instance of FileChooserParams and attaches it to [pigeon_instanceArg]. */ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebChromeClient.FileChooserParams, + callback: (Result) -> Unit + ) { + if (pigeonRegistrar.ignoreCallsToDart) { + callback( + Result.failure( + AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + callback(Result.success(Unit)) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + val isCaptureEnabledArg = isCaptureEnabled(pigeon_instanceArg) + val acceptTypesArg = acceptTypes(pigeon_instanceArg) + val modeArg = mode(pigeon_instanceArg) + val filenameHintArg = filenameHint(pigeon_instanceArg) + val binaryMessenger = pigeonRegistrar.binaryMessenger + val codec = pigeonRegistrar.codec + val channelName = + "dev.flutter.pigeon.webview_flutter_android.FileChooserParams.pigeon_newInstance" + val channel = BasicMessageChannel(binaryMessenger, channelName, codec) + channel.send( + listOf( + pigeon_identifierArg, + isCaptureEnabledArg, + acceptTypesArg, + modeArg, + filenameHintArg)) { + if (it is List<*>) { + if (it.size > 1) { + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + } else { + callback(Result.success(Unit)) + } + } else { + callback( + Result.failure( + AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } + } + } } - } -*/ /** - * This class defines a permission request and is used when web content - * requests access to protected resources. + * This class defines a permission request and is used when web content requests access to protected + * resources. * * See https://developer.android.com/reference/android/webkit/PermissionRequest. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiPermissionRequest(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiPermissionRequest( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { abstract fun resources(pigeon_instance: android.webkit.PermissionRequest): List - /** - * Call this method to grant origin the permission to access the given - * resources. - */ + /** Call this method to grant origin the permission to access the given resources. */ abstract fun grant(pigeon_instance: android.webkit.PermissionRequest, resources: List) /** Call this method to deny the request. */ @@ -6640,18 +4663,23 @@ abstract class PigeonApiPermissionRequest(open val pigeonRegistrar: AndroidWebki fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiPermissionRequest?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.grant", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.grant", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.PermissionRequest val resourcesArg = args[1] as List - val wrapped: List = try { - api.grant(pigeon_instanceArg, resourcesArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.grant(pigeon_instanceArg, resourcesArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6659,17 +4687,22 @@ abstract class PigeonApiPermissionRequest(open val pigeonRegistrar: AndroidWebki } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.deny", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.deny", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.PermissionRequest - val wrapped: List = try { - api.deny(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.deny(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6681,162 +4714,78 @@ abstract class PigeonApiPermissionRequest(open val pigeonRegistrar: AndroidWebki @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of PermissionRequest and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.PermissionRequest, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.PermissionRequest, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val resourcesArg = resources(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.PermissionRequest.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg, resourcesArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.PermissionRequest; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link PermissionRequest}. - * 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 PermissionRequestProxyApi extends PigeonApiPermissionRequest { - PermissionRequestProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public List resources(PermissionRequest pigeon_instance) { - return pigeon_instance.getResources(); - } - - @Override - public void grant(@NonNull PermissionRequest pigeon_instance,@NonNull List resources) { - pigeon_instance.grant(resources); - } - - @Override - public void deny(@NonNull PermissionRequest pigeon_instance) { - pigeon_instance.deny(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.PermissionRequest; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class PermissionRequestTest { - @Test - public void resources() { - final PigeonApiPermissionRequest api = new TestProxyApiRegistrar().getPigeonApiPermissionRequest(); - - final PermissionRequest instance = mock(PermissionRequest.class); - final List value = Arrays.asList("myString"); - when(instance.getResources()).thenReturn(value); - - assertEquals(value, api.resources(instance)); - } - - @Test - public void grant() { - final PigeonApiPermissionRequest api = new TestProxyApiRegistrar().getPigeonApiPermissionRequest(); - - final PermissionRequest instance = mock(PermissionRequest.class); - final List resources = Arrays.asList("myString"); - api.grant(instance, resources); - - verify(instance).grant(resources); - } - - @Test - public void deny() { - final PigeonApiPermissionRequest api = new TestProxyApiRegistrar().getPigeonApiPermissionRequest(); - - final PermissionRequest instance = mock(PermissionRequest.class); - api.deny(instance ); - - verify(instance).deny(); - } - } -*/ /** - * A callback interface used by the host application to notify the current page - * that its custom view has been dismissed. + * A callback interface used by the host application to notify the current page that its custom view + * has been dismissed. * * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCustomViewCallback(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiCustomViewCallback( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** Invoked when the host application dismisses the custom view. */ - abstract fun onCustomViewHidden(pigeon_instance: android.webkit.WebChromeClient.CustomViewCallback) + abstract fun onCustomViewHidden( + pigeon_instance: android.webkit.WebChromeClient.CustomViewCallback + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCustomViewCallback?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.CustomViewCallback.onCustomViewHidden", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.CustomViewCallback.onCustomViewHidden", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.WebChromeClient.CustomViewCallback - val wrapped: List = try { - api.onCustomViewHidden(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.onCustomViewHidden(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6848,109 +4797,50 @@ abstract class PigeonApiCustomViewCallback(open val pigeonRegistrar: AndroidWebk @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of CustomViewCallback and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.WebChromeClient.CustomViewCallback, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.WebChromeClient.CustomViewCallback, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.CustomViewCallback.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.CustomViewCallback.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebChromeClient.CustomViewCallback; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link CustomViewCallback}. - * 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 CustomViewCallbackProxyApi extends PigeonApiCustomViewCallback { - CustomViewCallbackProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @Override - public void onCustomViewHidden(@NonNull CustomViewCallback pigeon_instance) { - pigeon_instance.onCustomViewHidden(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.WebChromeClient.CustomViewCallback; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class CustomViewCallbackTest { - @Test - public void onCustomViewHidden() { - final PigeonApiCustomViewCallback api = new TestProxyApiRegistrar().getPigeonApiCustomViewCallback(); - - final CustomViewCallback instance = mock(CustomViewCallback.class); - api.onCustomViewHidden(instance ); - - verify(instance).onCustomViewHidden(); - } - } -*/ /** - * This class represents the basic building block for user interface - * components. + * This class represents the basic building block for user interface components. * * See https://developer.android.com/reference/android/view/View. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiView( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** Set the scrolled position of your view. */ abstract fun scrollTo(pigeon_instance: android.view.View, x: Long, y: Long) @@ -6968,19 +4858,22 @@ abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeo fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiView?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.scrollTo", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.scrollTo", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.View val xArg = args[1] as Long val yArg = args[2] as Long - val wrapped: List = try { - api.scrollTo(pigeon_instanceArg, xArg, yArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.scrollTo(pigeon_instanceArg, xArg, yArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -6988,19 +4881,22 @@ abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeo } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.scrollBy", codec) + val channel = + BasicMessageChannel( + binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.scrollBy", codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.View val xArg = args[1] as Long val yArg = args[2] as Long - val wrapped: List = try { - api.scrollBy(pigeon_instanceArg, xArg, yArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.scrollBy(pigeon_instanceArg, xArg, yArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7008,16 +4904,21 @@ abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeo } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.getScrollPosition", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.View.getScrollPosition", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.View - val wrapped: List = try { - listOf(api.getScrollPosition(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getScrollPosition(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7025,18 +4926,23 @@ abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeo } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.View.setOverScrollMode", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.View.setOverScrollMode", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.view.View val modeArg = args[1] as OverScrollMode - val wrapped: List = try { - api.setOverScrollMode(pigeon_instanceArg, modeArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.setOverScrollMode(pigeon_instanceArg, modeArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7048,16 +4954,16 @@ abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeo @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of View and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.view.View, callback: (Result) -> Unit) -{ + fun pigeon_newInstance(pigeon_instanceArg: android.view.View, callback: (Result) -> Unit) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.View.pigeon_newInstance" @@ -7065,153 +4971,51 @@ abstract class PigeonApiView(open val pigeonRegistrar: AndroidWebkitLibraryPigeo channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.view.View; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link View}. - * 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 ViewProxyApi extends PigeonApiView { - ViewProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @Override - public void scrollTo(@NonNull View pigeon_instance,@NonNull Long x, @NonNull Long y) { - pigeon_instance.scrollTo(x, y); - } - - @Override - public void scrollBy(@NonNull View pigeon_instance,@NonNull Long x, @NonNull Long y) { - pigeon_instance.scrollBy(x, y); - } - - @NonNull - @Override - public WebViewPoint getScrollPosition(@NonNull View pigeon_instance) { - return pigeon_instance.getScrollPosition(); - } - - @Override - public void setOverScrollMode(@NonNull View pigeon_instance,@NonNull OverScrollMode mode) { - pigeon_instance.setOverScrollMode(mode); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.view.View; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class ViewTest { - @Test - public void scrollTo() { - final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); - - final View instance = mock(View.class); - final Long x = 0; - final Long y = 0; - api.scrollTo(instance, x, y); - - verify(instance).scrollTo(x, y); - } - - @Test - public void scrollBy() { - final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); - - final View instance = mock(View.class); - final Long x = 0; - final Long y = 0; - api.scrollBy(instance, x, y); - - verify(instance).scrollBy(x, y); - } - - @Test - public void getScrollPosition() { - final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); - - final View instance = mock(View.class); - final WebViewPoint value = mock(WebViewPoint.class); - when(instance.getScrollPosition()).thenReturn(value); - - assertEquals(value, api.getScrollPosition(instance )); - } - - @Test - public void setOverScrollMode() { - final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); - - final View instance = mock(View.class); - final OverScrollMode mode = io.flutter.plugins.webviewflutter.OverScrollMode.ALWAYS; - api.setOverScrollMode(instance, mode); - - verify(instance).setOverScrollMode(mode); - } - } -*/ /** - * A callback interface used by the host application to set the Geolocation - * permission state for an origin. + * A callback interface used by the host application to set the Geolocation permission state for an + * origin. * * See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiGeolocationPermissionsCallback(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiGeolocationPermissionsCallback( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** Sets the Geolocation permission state for the supplied origin. */ - abstract fun invoke(pigeon_instance: android.webkit.GeolocationPermissions.Callback, origin: String, allow: Boolean, retain: Boolean) + abstract fun invoke( + pigeon_instance: android.webkit.GeolocationPermissions.Callback, + origin: String, + allow: Boolean, + retain: Boolean + ) companion object { @Suppress("LocalVariableName") - fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiGeolocationPermissionsCallback?) { + fun setUpMessageHandlers( + binaryMessenger: BinaryMessenger, + api: PigeonApiGeolocationPermissionsCallback? + ) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.GeolocationPermissionsCallback.invoke", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.GeolocationPermissionsCallback.invoke", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List @@ -7219,12 +5023,13 @@ abstract class PigeonApiGeolocationPermissionsCallback(open val pigeonRegistrar: val originArg = args[1] as String val allowArg = args[2] as Boolean val retainArg = args[3] as Boolean - val wrapped: List = try { - api.invoke(pigeon_instanceArg, originArg, allowArg, retainArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.invoke(pigeon_instanceArg, originArg, allowArg, retainArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7235,143 +5040,90 @@ abstract class PigeonApiGeolocationPermissionsCallback(open val pigeonRegistrar: } @Suppress("LocalVariableName", "FunctionName") - /** Creates a Dart instance of GeolocationPermissionsCallback and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.GeolocationPermissions.Callback, callback: (Result) -> Unit) -{ + /** + * Creates a Dart instance of GeolocationPermissionsCallback and attaches it to + * [pigeon_instanceArg]. + */ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.GeolocationPermissions.Callback, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.GeolocationPermissionsCallback.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.GeolocationPermissionsCallback.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.GeolocationPermissions.Callback; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link GeolocationPermissionsCallback}. - * 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 GeolocationPermissionsCallbackProxyApi extends PigeonApiGeolocationPermissionsCallback { - GeolocationPermissionsCallbackProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @Override - public void invoke(@NonNull GeolocationPermissionsCallback pigeon_instance,@NonNull String origin, @NonNull Boolean allow, @NonNull Boolean retain) { - pigeon_instance.invoke(origin, allow, retain); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.GeolocationPermissions.Callback; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class GeolocationPermissionsCallbackTest { - @Test - public void invoke() { - final PigeonApiGeolocationPermissionsCallback api = new TestProxyApiRegistrar().getPigeonApiGeolocationPermissionsCallback(); - - final GeolocationPermissionsCallback instance = mock(GeolocationPermissionsCallback.class); - final String origin = "myString"; - final Boolean allow = true; - final Boolean retain = true; - api.invoke(instance, origin, allow, retain); - - verify(instance).invoke(origin, allow, retain); - } - } -*/ /** * Represents a request for HTTP authentication. * * See https://developer.android.com/reference/android/webkit/HttpAuthHandler. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiHttpAuthHandler(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiHttpAuthHandler( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** - * Gets whether the credentials stored for the current host (i.e. the host - * for which `WebViewClient.onReceivedHttpAuthRequest` was called) are - * suitable for use. + * Gets whether the credentials stored for the current host (i.e. the host for which + * `WebViewClient.onReceivedHttpAuthRequest` was called) are suitable for use. */ abstract fun useHttpAuthUsernamePassword(pigeon_instance: android.webkit.HttpAuthHandler): Boolean /** Instructs the WebView to cancel the authentication request.. */ abstract fun cancel(pigeon_instance: android.webkit.HttpAuthHandler) - /** - * Instructs the WebView to proceed with the authentication with the given - * credentials. - */ - abstract fun proceed(pigeon_instance: android.webkit.HttpAuthHandler, username: String, password: String) + /** Instructs the WebView to proceed with the authentication with the given credentials. */ + abstract fun proceed( + pigeon_instance: android.webkit.HttpAuthHandler, + username: String, + password: String + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiHttpAuthHandler?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.useHttpAuthUsernamePassword", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.useHttpAuthUsernamePassword", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.HttpAuthHandler - val wrapped: List = try { - listOf(api.useHttpAuthUsernamePassword(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.useHttpAuthUsernamePassword(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7379,17 +5131,22 @@ abstract class PigeonApiHttpAuthHandler(open val pigeonRegistrar: AndroidWebkitL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.cancel", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.cancel", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.HttpAuthHandler - val wrapped: List = try { - api.cancel(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.cancel(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7397,19 +5154,24 @@ abstract class PigeonApiHttpAuthHandler(open val pigeonRegistrar: AndroidWebkitL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.proceed", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.proceed", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.HttpAuthHandler val usernameArg = args[1] as String val passwordArg = args[2] as String - val wrapped: List = try { - api.proceed(pigeon_instanceArg, usernameArg, passwordArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.proceed(pigeon_instanceArg, usernameArg, passwordArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7421,146 +5183,53 @@ abstract class PigeonApiHttpAuthHandler(open val pigeonRegistrar: AndroidWebkitL @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of HttpAuthHandler and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.HttpAuthHandler, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.HttpAuthHandler, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.HttpAuthHandler.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.HttpAuthHandler; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link HttpAuthHandler}. - * 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 HttpAuthHandlerProxyApi extends PigeonApiHttpAuthHandler { - HttpAuthHandlerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public Boolean useHttpAuthUsernamePassword(@NonNull HttpAuthHandler pigeon_instance) { - return pigeon_instance.useHttpAuthUsernamePassword(); - } - - @Override - public void cancel(@NonNull HttpAuthHandler pigeon_instance) { - pigeon_instance.cancel(); - } - - @Override - public void proceed(@NonNull HttpAuthHandler pigeon_instance,@NonNull String username, @NonNull String password) { - pigeon_instance.proceed(username, password); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.HttpAuthHandler; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class HttpAuthHandlerTest { - @Test - public void useHttpAuthUsernamePassword() { - final PigeonApiHttpAuthHandler api = new TestProxyApiRegistrar().getPigeonApiHttpAuthHandler(); - - final HttpAuthHandler instance = mock(HttpAuthHandler.class); - final Boolean value = true; - when(instance.useHttpAuthUsernamePassword()).thenReturn(value); - - assertEquals(value, api.useHttpAuthUsernamePassword(instance )); - } - - @Test - public void cancel() { - final PigeonApiHttpAuthHandler api = new TestProxyApiRegistrar().getPigeonApiHttpAuthHandler(); - - final HttpAuthHandler instance = mock(HttpAuthHandler.class); - api.cancel(instance ); - - verify(instance).cancel(); - } - - @Test - public void proceed() { - final PigeonApiHttpAuthHandler api = new TestProxyApiRegistrar().getPigeonApiHttpAuthHandler(); - - final HttpAuthHandler instance = mock(HttpAuthHandler.class); - final String username = "myString"; - final String password = "myString"; - api.proceed(instance, username, password); - - verify(instance).proceed(username, password); - } - } -*/ /** - * Defines a message containing a description and arbitrary data object that - * can be sent to a `Handler`. + * Defines a message containing a description and arbitrary data object that can be sent to a + * `Handler`. * * See https://developer.android.com/reference/android/os/Message. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiAndroidMessage(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiAndroidMessage( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** - * Sends this message to the Android native `Handler` specified by - * getTarget(). + * Sends this message to the Android native `Handler` specified by getTarget(). * * Throws a null pointer exception if this field has not been set. */ @@ -7571,17 +5240,22 @@ abstract class PigeonApiAndroidMessage(open val pigeonRegistrar: AndroidWebkitLi fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiAndroidMessage?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.AndroidMessage.sendToTarget", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.AndroidMessage.sendToTarget", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.os.Message - val wrapped: List = try { - api.sendToTarget(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.sendToTarget(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7593,109 +5267,48 @@ abstract class PigeonApiAndroidMessage(open val pigeonRegistrar: AndroidWebkitLi @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of AndroidMessage and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.os.Message, callback: (Result) -> Unit) -{ + fun pigeon_newInstance(pigeon_instanceArg: android.os.Message, callback: (Result) -> Unit) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.AndroidMessage.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.AndroidMessage.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.os.Message; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link AndroidMessage}. - * 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 AndroidMessageProxyApi extends PigeonApiAndroidMessage { - AndroidMessageProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @Override - public void sendToTarget(@NonNull AndroidMessage pigeon_instance) { - pigeon_instance.sendToTarget(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.os.Message; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class MessageTest { - @Test - public void sendToTarget() { - final PigeonApiAndroidMessage api = new TestProxyApiRegistrar().getPigeonApiAndroidMessage(); - - final AndroidMessage instance = mock(AndroidMessage.class); - api.sendToTarget(instance ); - - verify(instance).sendToTarget(); - } - } -*/ /** - * Defines a message containing a description and arbitrary data object that - * can be sent to a `Handler`. + * Defines a message containing a description and arbitrary data object that can be sent to a + * `Handler`. * * See https://developer.android.com/reference/android/webkit/ClientCertRequest. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiClientCertRequest(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiClientCertRequest( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** Cancel this request. */ abstract fun cancel(pigeon_instance: android.webkit.ClientCertRequest) @@ -7703,24 +5316,33 @@ abstract class PigeonApiClientCertRequest(open val pigeonRegistrar: AndroidWebki abstract fun ignore(pigeon_instance: android.webkit.ClientCertRequest) /** Proceed with the specified private key and client certificate chain. */ - abstract fun proceed(pigeon_instance: android.webkit.ClientCertRequest, privateKey: java.security.PrivateKey, chain: List) + abstract fun proceed( + pigeon_instance: android.webkit.ClientCertRequest, + privateKey: java.security.PrivateKey, + chain: List + ) companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiClientCertRequest?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.cancel", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.cancel", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.ClientCertRequest - val wrapped: List = try { - api.cancel(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.cancel(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7728,17 +5350,22 @@ abstract class PigeonApiClientCertRequest(open val pigeonRegistrar: AndroidWebki } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.ignore", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.ignore", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.ClientCertRequest - val wrapped: List = try { - api.ignore(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.ignore(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7746,19 +5373,24 @@ abstract class PigeonApiClientCertRequest(open val pigeonRegistrar: AndroidWebki } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.proceed", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.proceed", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.ClientCertRequest val privateKeyArg = args[1] as java.security.PrivateKey val chainArg = args[2] as List - val wrapped: List = try { - api.proceed(pigeon_instanceArg, privateKeyArg, chainArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.proceed(pigeon_instanceArg, privateKeyArg, chainArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -7770,159 +5402,68 @@ abstract class PigeonApiClientCertRequest(open val pigeonRegistrar: AndroidWebki @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of ClientCertRequest and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.ClientCertRequest, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.ClientCertRequest, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.ClientCertRequest.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.ClientCertRequest; -import java.security.cert.X509Certificate; -import java.security.PrivateKey; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link ClientCertRequest}. - * 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 ClientCertRequestProxyApi extends PigeonApiClientCertRequest { - ClientCertRequestProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @Override - public void cancel(@NonNull ClientCertRequest pigeon_instance) { - pigeon_instance.cancel(); - } - - @Override - public void ignore(@NonNull ClientCertRequest pigeon_instance) { - pigeon_instance.ignore(); - } - - @Override - public void proceed(@NonNull ClientCertRequest pigeon_instance,@NonNull java.security.PrivateKey privateKey, @NonNull List chain) { - pigeon_instance.proceed(privateKey, chain); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.ClientCertRequest; -import java.security.cert.X509Certificate; -import java.security.PrivateKey; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class ClientCertRequestTest { - @Test - public void cancel() { - final PigeonApiClientCertRequest api = new TestProxyApiRegistrar().getPigeonApiClientCertRequest(); - - final ClientCertRequest instance = mock(ClientCertRequest.class); - api.cancel(instance ); - - verify(instance).cancel(); - } - - @Test - public void ignore() { - final PigeonApiClientCertRequest api = new TestProxyApiRegistrar().getPigeonApiClientCertRequest(); - - final ClientCertRequest instance = mock(ClientCertRequest.class); - api.ignore(instance ); - - verify(instance).ignore(); - } - - @Test - public void proceed() { - final PigeonApiClientCertRequest api = new TestProxyApiRegistrar().getPigeonApiClientCertRequest(); - - final ClientCertRequest instance = mock(ClientCertRequest.class); - final java.security.PrivateKey privateKey = mock(PrivateKey.class); - final List chain = Arrays.asList(mock(X509Certificate.class)); - api.proceed(instance, privateKey, chain); - - verify(instance).proceed(privateKey, chain); - } - } -*/ /** * A private key. * - * The purpose of this interface is to group (and provide type safety for) all - * private key interfaces. + * The purpose of this interface is to group (and provide type safety for) all private key + * interfaces. * * See https://developer.android.com/reference/java/security/PrivateKey. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiPrivateKey(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +open class PigeonApiPrivateKey( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of PrivateKey and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: java.security.PrivateKey, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: java.security.PrivateKey, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.PrivateKey.pigeon_newInstance" @@ -7930,65 +5471,73 @@ open class PigeonApiPrivateKey(open val pigeonRegistrar: AndroidWebkitLibraryPig channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - } /** * Abstract class for X.509 certificates. * - * This provides a standard way to access all the attributes of an X.509 - * certificate. + * This provides a standard way to access all the attributes of an X.509 certificate. * * See https://developer.android.com/reference/java/security/cert/X509Certificate. */ @Suppress("UNCHECKED_CAST") -open class PigeonApiX509Certificate(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +open class PigeonApiX509Certificate( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of X509Certificate and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: java.security.cert.X509Certificate, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: java.security.cert.X509Certificate, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.X509Certificate.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.X509Certificate.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } @Suppress("FunctionName") /** An implementation of [PigeonApiCertificate] used to access callback methods */ - fun pigeon_getPigeonApiCertificate(): PigeonApiCertificate - { + fun pigeon_getPigeonApiCertificate(): PigeonApiCertificate { return pigeonRegistrar.getPigeonApiCertificate() } - } /** * Represents a request for handling an SSL error. @@ -7996,16 +5545,18 @@ open class PigeonApiX509Certificate(open val pigeonRegistrar: AndroidWebkitLibra * See https://developer.android.com/reference/android/webkit/SslErrorHandler. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiSslErrorHandler(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiSslErrorHandler( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** - * Instructs the WebView that encountered the SSL certificate error to - * terminate communication with the server. + * Instructs the WebView that encountered the SSL certificate error to terminate communication + * with the server. */ abstract fun cancel(pigeon_instance: android.webkit.SslErrorHandler) /** - * Instructs the WebView that encountered the SSL certificate error to ignore - * the error and continue communicating with the server. + * Instructs the WebView that encountered the SSL certificate error to ignore the error and + * continue communicating with the server. */ abstract fun proceed(pigeon_instance: android.webkit.SslErrorHandler) @@ -8014,17 +5565,22 @@ abstract class PigeonApiSslErrorHandler(open val pigeonRegistrar: AndroidWebkitL fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiSslErrorHandler?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.cancel", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.cancel", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.SslErrorHandler - val wrapped: List = try { - api.cancel(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.cancel(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8032,17 +5588,22 @@ abstract class PigeonApiSslErrorHandler(open val pigeonRegistrar: AndroidWebkitL } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.proceed", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.proceed", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.webkit.SslErrorHandler - val wrapped: List = try { - api.proceed(pigeon_instanceArg) - listOf(null) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + api.proceed(pigeon_instanceArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8054,126 +5615,54 @@ abstract class PigeonApiSslErrorHandler(open val pigeonRegistrar: AndroidWebkitL @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of SslErrorHandler and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.webkit.SslErrorHandler, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.webkit.SslErrorHandler, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.SslErrorHandler.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.SslErrorHandler; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link SslErrorHandler}. - * 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 SslErrorHandlerProxyApi extends PigeonApiSslErrorHandler { - SslErrorHandlerProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @Override - public void cancel(@NonNull SslErrorHandler pigeon_instance) { - pigeon_instance.cancel(); - } - - @Override - public void proceed(@NonNull SslErrorHandler pigeon_instance) { - pigeon_instance.proceed(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.webkit.SslErrorHandler; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class SslErrorHandlerTest { - @Test - public void cancel() { - final PigeonApiSslErrorHandler api = new TestProxyApiRegistrar().getPigeonApiSslErrorHandler(); - - final SslErrorHandler instance = mock(SslErrorHandler.class); - api.cancel(instance ); - - verify(instance).cancel(); - } - - @Test - public void proceed() { - final PigeonApiSslErrorHandler api = new TestProxyApiRegistrar().getPigeonApiSslErrorHandler(); - - final SslErrorHandler instance = mock(SslErrorHandler.class); - api.proceed(instance ); - - verify(instance).proceed(); - } - } -*/ /** - * This class represents a set of one or more SSL errors and the associated SSL - * certificate. + * This class represents a set of one or more SSL errors and the associated SSL certificate. * * See https://developer.android.com/reference/android/net/http/SslError. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiSslError(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiSslError( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** Gets the SSL certificate associated with this object. */ - abstract fun certificate(pigeon_instance: android.net.http.SslError): android.net.http.SslCertificate + abstract fun certificate( + pigeon_instance: android.net.http.SslError + ): android.net.http.SslCertificate /** Gets the URL associated with this object. */ abstract fun url(pigeon_instance: android.net.http.SslError): String @@ -8189,16 +5678,21 @@ abstract class PigeonApiSslError(open val pigeonRegistrar: AndroidWebkitLibraryP fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiSslError?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslError.getPrimaryError", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslError.getPrimaryError", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslError - val wrapped: List = try { - listOf(api.getPrimaryError(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getPrimaryError(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8206,17 +5700,22 @@ abstract class PigeonApiSslError(open val pigeonRegistrar: AndroidWebkitLibraryP } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslError.hasError", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslError.hasError", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslError val errorArg = args[1] as SslErrorType - val wrapped: List = try { - listOf(api.hasError(pigeon_instanceArg, errorArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.hasError(pigeon_instanceArg, errorArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8228,16 +5727,19 @@ abstract class PigeonApiSslError(open val pigeonRegistrar: AndroidWebkitLibraryP @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of SslError and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.net.http.SslError, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.net.http.SslError, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val certificateArg = certificate(pigeon_instanceArg) val urlArg = url(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger @@ -8247,150 +5749,30 @@ abstract class PigeonApiSslError(open val pigeonRegistrar: AndroidWebkitLibraryP channel.send(listOf(pigeon_identifierArg, certificateArg, urlArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.net.http.SslError; -import android.net.http.SslCertificate; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link SslError}. - * 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 SslErrorProxyApi extends PigeonApiSslError { - SslErrorProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public android.net.http.SslCertificate certificate(SslError pigeon_instance) { - return pigeon_instance.getCertificate(); - } - - @NonNull - @Override - public String url(SslError pigeon_instance) { - return pigeon_instance.getUrl(); - } - - @NonNull - @Override - public SslErrorType getPrimaryError(@NonNull SslError pigeon_instance) { - return pigeon_instance.getPrimaryError(); - } - - @NonNull - @Override - public Boolean hasError(@NonNull SslError pigeon_instance,@NonNull SslErrorType error) { - return pigeon_instance.hasError(error); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.net.http.SslError; -import android.net.http.SslCertificate; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class SslErrorTest { - @Test - public void certificate() { - final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); - - final SslError instance = mock(SslError.class); - final android.net.http.SslCertificate value = mock(SslCertificate.class); - when(instance.getCertificate()).thenReturn(value); - - assertEquals(value, api.certificate(instance)); - } - - @Test - public void url() { - final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); - - final SslError instance = mock(SslError.class); - final String value = "myString"; - when(instance.getUrl()).thenReturn(value); - - assertEquals(value, api.url(instance)); - } - - @Test - public void getPrimaryError() { - final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); - - final SslError instance = mock(SslError.class); - final SslErrorType value = io.flutter.plugins.webviewflutter.SslErrorType.DATE_INVALID; - when(instance.getPrimaryError()).thenReturn(value); - - assertEquals(value, api.getPrimaryError(instance )); - } - - @Test - public void hasError() { - final PigeonApiSslError api = new TestProxyApiRegistrar().getPigeonApiSslError(); - - final SslError instance = mock(SslError.class); - final SslErrorType error = io.flutter.plugins.webviewflutter.SslErrorType.DATE_INVALID; - final Boolean value = true; - when(instance.hasError(error)).thenReturn(value); - - assertEquals(value, api.hasError(instance, error)); - } - } -*/ /** * A distinguished name helper class. * - * A 3-tuple of: - * the most specific common name (CN) - * the most specific organization (O) - * the most specific organizational unit (OU) + * A 3-tuple of: the most specific common name (CN) the most specific organization (O) the most + * specific organizational unit (OU) */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiSslCertificateDName(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiSslCertificateDName( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** The most specific Common-name (CN) component of this name. */ abstract fun getCName(pigeon_instance: android.net.http.SslCertificate.DName): String @@ -8408,16 +5790,21 @@ abstract class PigeonApiSslCertificateDName(open val pigeonRegistrar: AndroidWeb fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiSslCertificateDName?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getCName", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getCName", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate.DName - val wrapped: List = try { - listOf(api.getCName(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getCName(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8425,16 +5812,21 @@ abstract class PigeonApiSslCertificateDName(open val pigeonRegistrar: AndroidWeb } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getDName", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getDName", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate.DName - val wrapped: List = try { - listOf(api.getDName(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getDName(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8442,16 +5834,21 @@ abstract class PigeonApiSslCertificateDName(open val pigeonRegistrar: AndroidWeb } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getOName", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getOName", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate.DName - val wrapped: List = try { - listOf(api.getOName(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getOName(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8459,16 +5856,21 @@ abstract class PigeonApiSslCertificateDName(open val pigeonRegistrar: AndroidWeb } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getUName", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.getUName", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate.DName - val wrapped: List = try { - listOf(api.getUName(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getUName(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8480,202 +5882,97 @@ abstract class PigeonApiSslCertificateDName(open val pigeonRegistrar: AndroidWeb @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of SslCertificateDName and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.net.http.SslCertificate.DName, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.net.http.SslCertificate.DName, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.SslCertificateDName.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.net.http.SslCertificate.DName; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link SslCertificateDName}. - * 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 SslCertificateDNameProxyApi extends PigeonApiSslCertificateDName { - SslCertificateDNameProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public String getCName(@NonNull SslCertificateDName pigeon_instance) { - return pigeon_instance.getCName(); - } - - @NonNull - @Override - public String getDName(@NonNull SslCertificateDName pigeon_instance) { - return pigeon_instance.getDName(); - } - - @NonNull - @Override - public String getOName(@NonNull SslCertificateDName pigeon_instance) { - return pigeon_instance.getOName(); - } - - @NonNull - @Override - public String getUName(@NonNull SslCertificateDName pigeon_instance) { - return pigeon_instance.getUName(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.net.http.SslCertificate.DName; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class SslCertificateDNameTest { - @Test - public void getCName() { - final PigeonApiSslCertificateDName api = new TestProxyApiRegistrar().getPigeonApiSslCertificateDName(); - - final SslCertificateDName instance = mock(SslCertificateDName.class); - final String value = "myString"; - when(instance.getCName()).thenReturn(value); - - assertEquals(value, api.getCName(instance )); - } - - @Test - public void getDName() { - final PigeonApiSslCertificateDName api = new TestProxyApiRegistrar().getPigeonApiSslCertificateDName(); - - final SslCertificateDName instance = mock(SslCertificateDName.class); - final String value = "myString"; - when(instance.getDName()).thenReturn(value); - - assertEquals(value, api.getDName(instance )); - } - - @Test - public void getOName() { - final PigeonApiSslCertificateDName api = new TestProxyApiRegistrar().getPigeonApiSslCertificateDName(); - - final SslCertificateDName instance = mock(SslCertificateDName.class); - final String value = "myString"; - when(instance.getOName()).thenReturn(value); - - assertEquals(value, api.getOName(instance )); - } - - @Test - public void getUName() { - final PigeonApiSslCertificateDName api = new TestProxyApiRegistrar().getPigeonApiSslCertificateDName(); - - final SslCertificateDName instance = mock(SslCertificateDName.class); - final String value = "myString"; - when(instance.getUName()).thenReturn(value); - - assertEquals(value, api.getUName(instance )); - } - } -*/ /** * SSL certificate info (certificate details) class. * * See https://developer.android.com/reference/android/net/http/SslCertificate. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiSslCertificate(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiSslCertificate( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** Issued-by distinguished name or null if none has been set. */ - abstract fun getIssuedBy(pigeon_instance: android.net.http.SslCertificate): android.net.http.SslCertificate.DName? + abstract fun getIssuedBy( + pigeon_instance: android.net.http.SslCertificate + ): android.net.http.SslCertificate.DName? /** Issued-to distinguished name or null if none has been set. */ - abstract fun getIssuedTo(pigeon_instance: android.net.http.SslCertificate): android.net.http.SslCertificate.DName? + abstract fun getIssuedTo( + pigeon_instance: android.net.http.SslCertificate + ): android.net.http.SslCertificate.DName? - /** - * Not-after date from the certificate validity period or null if none has been - * set. - */ + /** Not-after date from the certificate validity period or null if none has been set. */ abstract fun getValidNotAfterMsSinceEpoch(pigeon_instance: android.net.http.SslCertificate): Long? - /** - * Not-before date from the certificate validity period or null if none has - * been set. - */ - abstract fun getValidNotBeforeMsSinceEpoch(pigeon_instance: android.net.http.SslCertificate): Long? + /** Not-before date from the certificate validity period or null if none has been set. */ + abstract fun getValidNotBeforeMsSinceEpoch( + pigeon_instance: android.net.http.SslCertificate + ): Long? /** - * The X509Certificate used to create this SslCertificate or null if no - * certificate was provided. + * The X509Certificate used to create this SslCertificate or null if no certificate was provided. * * Always returns null on Android versions below Q. */ - abstract fun getX509Certificate(pigeon_instance: android.net.http.SslCertificate): java.security.cert.X509Certificate? + abstract fun getX509Certificate( + pigeon_instance: android.net.http.SslCertificate + ): java.security.cert.X509Certificate? companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiSslCertificate?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getIssuedBy", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getIssuedBy", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = try { - listOf(api.getIssuedBy(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getIssuedBy(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8683,16 +5980,21 @@ abstract class PigeonApiSslCertificate(open val pigeonRegistrar: AndroidWebkitLi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getIssuedTo", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getIssuedTo", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = try { - listOf(api.getIssuedTo(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getIssuedTo(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8700,16 +6002,21 @@ abstract class PigeonApiSslCertificate(open val pigeonRegistrar: AndroidWebkitLi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getValidNotAfterMsSinceEpoch", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getValidNotAfterMsSinceEpoch", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = try { - listOf(api.getValidNotAfterMsSinceEpoch(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getValidNotAfterMsSinceEpoch(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8717,16 +6024,21 @@ abstract class PigeonApiSslCertificate(open val pigeonRegistrar: AndroidWebkitLi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getValidNotBeforeMsSinceEpoch", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getValidNotBeforeMsSinceEpoch", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = try { - listOf(api.getValidNotBeforeMsSinceEpoch(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getValidNotBeforeMsSinceEpoch(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8734,16 +6046,21 @@ abstract class PigeonApiSslCertificate(open val pigeonRegistrar: AndroidWebkitLi } } run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getX509Certificate", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.SslCertificate.getX509Certificate", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as android.net.http.SslCertificate - val wrapped: List = try { - listOf(api.getX509Certificate(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getX509Certificate(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8755,182 +6072,50 @@ abstract class PigeonApiSslCertificate(open val pigeonRegistrar: AndroidWebkitLi @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of SslCertificate and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: android.net.http.SslCertificate, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: android.net.http.SslCertificate, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec - val channelName = "dev.flutter.pigeon.webview_flutter_android.SslCertificate.pigeon_newInstance" + val channelName = + "dev.flutter.pigeon.webview_flutter_android.SslCertificate.pigeon_newInstance" val channel = BasicMessageChannel(binaryMessenger, channelName, codec) channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.net.http.SslCertificate; -import android.net.http.SslCertificate.DName; -import java.security.cert.X509Certificate; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link SslCertificate}. - * 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 SslCertificateProxyApi extends PigeonApiSslCertificate { - SslCertificateProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @Nullable - @Override - public android.net.http.SslCertificate.DName getIssuedBy(@NonNull SslCertificate pigeon_instance) { - return pigeon_instance.getIssuedBy(); - } - - @Nullable - @Override - public android.net.http.SslCertificate.DName getIssuedTo(@NonNull SslCertificate pigeon_instance) { - return pigeon_instance.getIssuedTo(); - } - - @Nullable - @Override - public Long getValidNotAfterMsSinceEpoch(@NonNull SslCertificate pigeon_instance) { - return pigeon_instance.getValidNotAfterMsSinceEpoch(); - } - - @Nullable - @Override - public Long getValidNotBeforeMsSinceEpoch(@NonNull SslCertificate pigeon_instance) { - return pigeon_instance.getValidNotBeforeMsSinceEpoch(); - } - - @Nullable - @Override - public java.security.cert.X509Certificate getX509Certificate(@NonNull SslCertificate pigeon_instance) { - return pigeon_instance.getX509Certificate(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import android.net.http.SslCertificate; -import android.net.http.SslCertificate.DName; -import java.security.cert.X509Certificate; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class SslCertificateTest { - @Test - public void getIssuedBy() { - final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); - - final SslCertificate instance = mock(SslCertificate.class); - final android.net.http.SslCertificate.DName value = mock(SslCertificateDName.class); - when(instance.getIssuedBy()).thenReturn(value); - - assertEquals(value, api.getIssuedBy(instance )); - } - - @Test - public void getIssuedTo() { - final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); - - final SslCertificate instance = mock(SslCertificate.class); - final android.net.http.SslCertificate.DName value = mock(SslCertificateDName.class); - when(instance.getIssuedTo()).thenReturn(value); - - assertEquals(value, api.getIssuedTo(instance )); - } - - @Test - public void getValidNotAfterMsSinceEpoch() { - final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); - - final SslCertificate instance = mock(SslCertificate.class); - final Long value = 0; - when(instance.getValidNotAfterMsSinceEpoch()).thenReturn(value); - - assertEquals(value, api.getValidNotAfterMsSinceEpoch(instance )); - } - - @Test - public void getValidNotBeforeMsSinceEpoch() { - final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); - - final SslCertificate instance = mock(SslCertificate.class); - final Long value = 0; - when(instance.getValidNotBeforeMsSinceEpoch()).thenReturn(value); - - assertEquals(value, api.getValidNotBeforeMsSinceEpoch(instance )); - } - - @Test - public void getX509Certificate() { - final PigeonApiSslCertificate api = new TestProxyApiRegistrar().getPigeonApiSslCertificate(); - - final SslCertificate instance = mock(SslCertificate.class); - final java.security.cert.X509Certificate value = mock(X509Certificate.class); - when(instance.getX509Certificate()).thenReturn(value); - - assertEquals(value, api.getX509Certificate(instance )); - } - } -*/ /** * Abstract class for managing a variety of identity certificates. * * See https://developer.android.com/reference/java/security/cert/Certificate. */ @Suppress("UNCHECKED_CAST") -abstract class PigeonApiCertificate(open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar) { +abstract class PigeonApiCertificate( + open val pigeonRegistrar: AndroidWebkitLibraryPigeonProxyApiRegistrar +) { /** The encoded form of this certificate. */ abstract fun getEncoded(pigeon_instance: java.security.cert.Certificate): ByteArray @@ -8939,16 +6124,21 @@ abstract class PigeonApiCertificate(open val pigeonRegistrar: AndroidWebkitLibra fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiCertificate?) { val codec = api?.pigeonRegistrar?.codec ?: AndroidWebkitLibraryPigeonCodec() run { - val channel = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.webview_flutter_android.Certificate.getEncoded", codec) + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.Certificate.getEncoded", + codec) if (api != null) { channel.setMessageHandler { message, reply -> val args = message as List val pigeon_instanceArg = args[0] as java.security.cert.Certificate - val wrapped: List = try { - listOf(api.getEncoded(pigeon_instanceArg)) - } catch (exception: Throwable) { - AndroidWebkitLibraryPigeonUtils.wrapError(exception) - } + val wrapped: List = + try { + listOf(api.getEncoded(pigeon_instanceArg)) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } reply.reply(wrapped) } } else { @@ -8960,16 +6150,19 @@ abstract class PigeonApiCertificate(open val pigeonRegistrar: AndroidWebkitLibra @Suppress("LocalVariableName", "FunctionName") /** Creates a Dart instance of Certificate and attaches it to [pigeon_instanceArg]. */ - fun pigeon_newInstance(pigeon_instanceArg: java.security.cert.Certificate, callback: (Result) -> Unit) -{ + fun pigeon_newInstance( + pigeon_instanceArg: java.security.cert.Certificate, + callback: (Result) -> Unit + ) { if (pigeonRegistrar.ignoreCallsToDart) { callback( Result.failure( AndroidWebKitError("ignore-calls-error", "Calls to Dart are being ignored.", ""))) - } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { + } else if (pigeonRegistrar.instanceManager.containsInstance(pigeon_instanceArg)) { callback(Result.success(Unit)) - } else { - val pigeon_identifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) + } else { + val pigeon_identifierArg = + pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeon_instanceArg) val binaryMessenger = pigeonRegistrar.binaryMessenger val codec = pigeonRegistrar.codec val channelName = "dev.flutter.pigeon.webview_flutter_android.Certificate.pigeon_newInstance" @@ -8977,83 +6170,17 @@ abstract class PigeonApiCertificate(open val pigeonRegistrar: AndroidWebkitLibra channel.send(listOf(pigeon_identifierArg)) { if (it is List<*>) { if (it.size > 1) { - callback(Result.failure(AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) + callback( + Result.failure( + AndroidWebKitError(it[0] as String, it[1] as String, it[2] as String?))) } else { callback(Result.success(Unit)) } } else { - callback(Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) - } + callback( + Result.failure(AndroidWebkitLibraryPigeonUtils.createConnectionError(channelName))) + } } } } - -} - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import java.security.cert.Certificate; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import java.util.List; -import java.util.Map; - -/** - * ProxyApi implementation for {@link Certificate}. - * 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 CertificateProxyApi extends PigeonApiCertificate { - CertificateProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { - super(pigeonRegistrar); - } - - @NonNull - @Override - public ByteArray getEncoded(@NonNull Certificate pigeon_instance) { - return pigeon_instance.getEncoded(); - } - -} -*/ - -/* -// 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. - -package io.flutter.plugins.webviewflutter; - -import java.security.cert.Certificate; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class CertificateTest { - @Test - public void getEncoded() { - final PigeonApiCertificate api = new TestProxyApiRegistrar().getPigeonApiCertificate(); - - final Certificate instance = mock(Certificate.class); - final ByteArray value = {0xA1}; - when(instance.getEncoded()).thenReturn(value); - - assertEquals(value, api.getEncoded(instance )); - } - } -*/ diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CertificateProxyApi.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CertificateProxyApi.java index 995c8e6df516..b80f44ff255b 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CertificateProxyApi.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CertificateProxyApi.java @@ -4,18 +4,14 @@ package io.flutter.plugins.webviewflutter; -import java.security.cert.Certificate; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - +import java.security.cert.Certificate; import java.security.cert.CertificateEncodingException; -import java.util.List; -import java.util.Map; /** - * ProxyApi implementation for {@link Certificate}. - * 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. + * ProxyApi implementation for {@link Certificate}. 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 CertificateProxyApi extends PigeonApiCertificate { CertificateProxyApi(@NonNull ProxyApiRegistrar pigeonRegistrar) { diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CertificateTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CertificateTest.java index 61206eb03a2d..6be37fe37ff7 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CertificateTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CertificateTest.java @@ -4,22 +4,14 @@ package io.flutter.plugins.webviewflutter; -import java.security.cert.Certificate; -import org.junit.Test; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import org.mockito.Mockito; -import static org.mockito.Mockito.any; - -import java.security.cert.CertificateEncodingException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.security.cert.Certificate; +import java.security.cert.CertificateEncodingException; +import org.junit.Test; + public class CertificateTest { @Test public void getEncoded() throws CertificateEncodingException { diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart index 7f0f17d2116a..516fba97f802 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart @@ -8,7 +8,8 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' + show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -19,7 +20,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -28,6 +30,7 @@ List wrapResponse({Object? result, PlatformException? error, bool empty } return [error.code, error.message, error.details]; } + /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -110,9 +113,10 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> _weakInstances = - >{}; - final Map _strongInstances = {}; + final Map> + _weakInstances = >{}; + final Map _strongInstances = + {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -122,7 +126,8 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = + _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -130,37 +135,67 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); - WebResourceRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebResourceResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebResourceError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebResourceErrorCompat.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebViewPoint.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - ConsoleMessage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - CookieManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebSettings.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - JavaScriptChannel.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebViewClient.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - DownloadListener.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebChromeClient.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - FlutterAssetManager.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WebStorage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - FileChooserParams.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - PermissionRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - CustomViewCallback.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + _PigeonInternalInstanceManagerApi.setUpMessageHandlers( + instanceManager: instanceManager); + WebResourceRequest.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebResourceResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebResourceError.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebResourceErrorCompat.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebViewPoint.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + ConsoleMessage.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + CookieManager.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebSettings.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + JavaScriptChannel.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebViewClient.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + DownloadListener.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebChromeClient.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + FlutterAssetManager.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WebStorage.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + FileChooserParams.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + PermissionRequest.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + CustomViewCallback.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); View.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - GeolocationPermissionsCallback.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - HttpAuthHandler.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AndroidMessage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - ClientCertRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - PrivateKey.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - X509Certificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - SslErrorHandler.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - SslError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - SslCertificateDName.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - SslCertificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - Certificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + GeolocationPermissionsCallback.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + HttpAuthHandler.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AndroidMessage.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + ClientCertRequest.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + PrivateKey.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + X509Certificate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + SslErrorHandler.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + SslError.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + SslCertificateDName.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + SslCertificate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + Certificate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -224,15 +259,20 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference(int identifier) { - final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference( + int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = + _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = + _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass copy = + strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = WeakReference(copy); + _weakInstances[identifier] = + WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -256,17 +296,20 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance( + PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier( + PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = WeakReference(instance); + _weakInstances[identifier] = + WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); @@ -393,275 +436,30 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } -} - -/// Handles constructing objects and calling static methods for the Android -/// Interactive Media Ads native library. -/// -/// This class provides dependency injection for the implementations of the -/// platform interface classes. Improving the ease of unit testing and/or -/// overriding the underlying Android classes. -/// -/// By default each function calls the default constructor of the class it -/// intends to return. -class AndroidWebkitGProxy { - /// Constructs an [AndroidWebkitGProxy]. - const AndroidWebkitGProxy({ - this.newWebView = WebView.new, - this.newJavaScriptChannel = JavaScriptChannel.new, - this.newWebViewClient = WebViewClient.new, - this.newDownloadListener = DownloadListener.new, - this.newWebChromeClient = WebChromeClient.new, - this.setWebContentsDebuggingEnabledWebView = - WebView.setWebContentsDebuggingEnabled, - this.instanceCookieManager = _instanceCookieManager, - this.instanceFlutterAssetManager = _instanceFlutterAssetManager, - this.instanceWebStorage = _instanceWebStorage, - }); - - /// Constructs [WebView]. - final WebView Function({ - void Function( - WebView, - int, - int, - int, - int, - )? onScrollChanged, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWebView; - - /// Constructs [JavaScriptChannel]. - final JavaScriptChannel Function({ - required void Function( - JavaScriptChannel, - String, - ) postMessage, - required String channelName, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newJavaScriptChannel; - - /// Constructs [WebViewClient]. - final WebViewClient Function({ - void Function( - WebViewClient, - WebView, - String, - )? onPageStarted, - void Function( - WebViewClient, - WebView, - String, - )? onPageFinished, - void Function( - WebViewClient, - WebView, - WebResourceRequest, - WebResourceResponse, - )? onReceivedHttpError, - void Function( - WebViewClient, - WebView, - WebResourceRequest, - WebResourceError, - )? onReceivedRequestError, - void Function( - WebViewClient, - WebView, - WebResourceRequest, - WebResourceErrorCompat, - )? onReceivedRequestErrorCompat, - void Function( - WebViewClient, - WebView, - int, - String, - String, - )? onReceivedError, - void Function( - WebViewClient, - WebView, - WebResourceRequest, - )? requestLoading, - void Function( - WebViewClient, - WebView, - String, - )? urlLoading, - void Function( - WebViewClient, - WebView, - String, - bool, - )? doUpdateVisitedHistory, - void Function( - WebViewClient, - WebView, - HttpAuthHandler, - String, - String, - )? onReceivedHttpAuthRequest, - void Function( - WebViewClient, - WebView, - AndroidMessage, - AndroidMessage, - )? onFormResubmission, - void Function( - WebViewClient, - WebView, - String, - )? onLoadResource, - void Function( - WebViewClient, - WebView, - String, - )? onPageCommitVisible, - void Function( - WebViewClient, - WebView, - ClientCertRequest, - )? onReceivedClientCertRequest, - void Function( - WebViewClient, - WebView, - String, - String?, - String, - )? onReceivedLoginRequest, - void Function( - WebViewClient, - WebView, - SslErrorHandler, - SslError, - )? onReceivedSslError, - void Function( - WebViewClient, - WebView, - double, - double, - )? onScaleChanged, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWebViewClient; - - /// Constructs [DownloadListener]. - final DownloadListener Function({ - required void Function( - DownloadListener, - String, - String, - String, - String, - int, - ) onDownloadStart, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newDownloadListener; - - /// Constructs [WebChromeClient]. - final WebChromeClient Function({ - required Future> Function( - WebChromeClient, - WebView, - FileChooserParams, - ) onShowFileChooser, - required Future Function( - WebChromeClient, - WebView, - String, - String, - ) onJsConfirm, - void Function( - WebChromeClient, - WebView, - int, - )? onProgressChanged, - void Function( - WebChromeClient, - PermissionRequest, - )? onPermissionRequest, - void Function( - WebChromeClient, - View, - CustomViewCallback, - )? onShowCustomView, - void Function(WebChromeClient)? onHideCustomView, - void Function( - WebChromeClient, - String, - GeolocationPermissionsCallback, - )? onGeolocationPermissionsShowPrompt, - void Function(WebChromeClient)? onGeolocationPermissionsHidePrompt, - void Function( - WebChromeClient, - ConsoleMessage, - )? onConsoleMessage, - Future Function( - WebChromeClient, - WebView, - String, - String, - )? onJsAlert, - Future Function( - WebChromeClient, - WebView, - String, - String, - String, - )? onJsPrompt, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWebChromeClient; - - /// Calls to [WebView.setWebContentsDebuggingEnabled]. - final Future Function( - bool, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) setWebContentsDebuggingEnabledWebView; - - /// Calls to [CookieManager.instance]. - final CookieManager Function() instanceCookieManager; - - /// Calls to [FlutterAssetManager.instance]. - final FlutterAssetManager Function() instanceFlutterAssetManager; - - /// Calls to [WebStorage.instance]. - final WebStorage Function() instanceWebStorage; - - static CookieManager _instanceCookieManager() => CookieManager.instance; - - static FlutterAssetManager _instanceFlutterAssetManager() => - FlutterAssetManager.instance; + const _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } - static WebStorage _instanceWebStorage() => WebStorage.instance; + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } } - /// Mode of how to select files for a file chooser. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. @@ -671,14 +469,17 @@ enum FileChooserMode { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. open, + /// Similar to [open] but allows multiple files to be selected. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. openMultiple, + /// Allows picking a nonexistent file and saving it. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. save, + /// Indicates a `FileChooserMode` with an unknown mode. /// /// This does not represent an actual value provided by the platform and only @@ -694,22 +495,27 @@ enum ConsoleMessageLevel { /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#DEBUG. debug, + /// Indicates a message is provided as an error. /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#ERROR. error, + /// Indicates a message is provided as a basic log message. /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#LOG. log, + /// Indicates a message is provided as a tip. /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#TIP. tip, + /// Indicates a message is provided as a warning. /// /// See https://developer.android.com/reference/android/webkit/ConsoleMessage.MessageLevel#WARNING. warning, + /// Indicates a message with an unknown level. /// /// This does not represent an actual value provided by the platform and only @@ -724,11 +530,14 @@ enum OverScrollMode { /// Always allow a user to over-scroll this view, provided it is a view that /// can scroll. always, + /// Allow a user to over-scroll this view only if the content is large enough /// to meaningfully scroll, provided it is a view that can scroll. ifContentScrolls, + /// Never allow a user to over-scroll this view. never, + /// The type is not recognized by this wrapper. unknown, } @@ -739,21 +548,26 @@ enum OverScrollMode { enum SslErrorType { /// The date of the certificate is invalid. dateInvalid, + /// The certificate has expired. expired, + /// Hostname mismatch. idMismatch, + /// A generic error occurred. invalid, + /// The certificate is not yet valid. notYetValid, + /// The certificate authority is not trusted. untrusted, + /// The type is not recognized by this wrapper. unknown, } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -761,16 +575,16 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is FileChooserMode) { + } else if (value is FileChooserMode) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is ConsoleMessageLevel) { + } else if (value is ConsoleMessageLevel) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is OverScrollMode) { + } else if (value is OverScrollMode) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is SslErrorType) { + } else if (value is SslErrorType) { buffer.putUint8(132); writeValue(buffer, value.index); } else { @@ -781,16 +595,16 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : FileChooserMode.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : ConsoleMessageLevel.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : OverScrollMode.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : SslErrorType.values[value]; default: @@ -798,6 +612,7 @@ class _PigeonCodec extends StandardMessageCodec { } } } + /// Encompasses parameters to the `WebViewClient.shouldInterceptRequest` method. /// /// See https://developer.android.com/reference/android/webkit/WebResourceRequest. @@ -8415,4 +8230,3 @@ class Certificate extends PigeonInternalProxyApiBaseClass { ); } } - diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 77b27db1e573..1ada7690874b 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -27,11 +27,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: - git: - url: git@github.com:bparrishMines/packages.git - ref: pigeon_helper - path: packages/pigeon + pigeon: ^25.3.1 topics: - html From 095e9dc90aebb00462f9336ef1b4669f639a9d4c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:07:13 -0400 Subject: [PATCH 08/34] implement auth request --- .../lib/src/webkit_ssl_auth_request.dart | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart new file mode 100644 index 000000000000..fcb27f67caa9 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart @@ -0,0 +1,112 @@ +// 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 'package:flutter/services.dart'; +import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; +import 'common/web_kit.g.dart'; + +class WebKitSslAuthRequest extends PlatformSslAuthRequest { + WebKitSslAuthRequest({ + required super.certificates, + required SecTrust trust, + required void Function( + UrlSessionAuthChallengeDisposition disposition, + Map? credentialMap, + ) onResponse, + }) : _trust = trust, + _onResponse = onResponse; + + final SecTrust _trust; + + final void Function( + UrlSessionAuthChallengeDisposition disposition, + Map? credentialMap, + ) _onResponse; + + static Future fromTrust({ + required SecTrust trust, + required void Function( + UrlSessionAuthChallengeDisposition disposition, + Map? credentialMap, + ) onResponse, + }) async { + // Converts a list native certificate objects to a list of platform + // interface certificates. + Future> fromNativeCertificates( + List certificates, [ + List errors = const [], + ]) async { + return [ + for (final SecCertificate certificate in certificates) + SslCertificate( + data: await SecCertificate.copyData(certificate), + errors: errors, + ), + ]; + } + + try { + final bool trusted = await SecTrust.evaluateWithError(trust); + + // Since this is expected to be an auth request for an invalid + // certificate, the method above is expected to throw with an error + // message. However, this handles the scenario where the certificate is + // valid or doesn't throw just in case. + final List certificates = + (await SecTrust.copyCertificateChain(trust)) ?? []; + if (trusted) { + return WebKitSslAuthRequest( + certificates: await fromNativeCertificates(certificates), + trust: trust, + onResponse: onResponse, + ); + } else { + return WebKitSslAuthRequest( + certificates: await fromNativeCertificates( + certificates, + [ + const SslError( + description: 'Certificate failed evaluation.', + ) + ], + ), + trust: trust, + onResponse: onResponse, + ); + } + } on PlatformException catch (exception) { + final List certificates = + (await SecTrust.copyCertificateChain(trust)) ?? []; + + return WebKitSslAuthRequest( + certificates: await fromNativeCertificates( + certificates, + [ + SslError( + description: '${exception.code}: ${exception.message ?? ''}', + ) + ], + ), + trust: trust, + onResponse: onResponse, + ); + } + } + + @override + Future cancel() async { + _onResponse( + UrlSessionAuthChallengeDisposition.cancelAuthenticationChallenge, + null, + ); + } + + @override + Future proceed() async { + _onResponse( + UrlSessionAuthChallengeDisposition.useCredential, + {'serverTrust': _trust}, + ); + } +} From 1fbe36acbfe023b35cbf50b0ec5bf85eebacb711 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 23 Apr 2025 18:43:52 -0400 Subject: [PATCH 09/34] improve code a bit --- .../WebKitLibrary.g.swift | 41 ++++-- .../lib/src/common/web_kit.g.dart | 46 +++++-- .../lib/src/common/webkit_constants.dart | 4 + .../lib/src/webkit_ssl_auth_request.dart | 15 ++- .../lib/src/webkit_webview_controller.dart | 117 +++++++++++------- .../pigeons/web_kit.dart | 2 +- 6 files changed, 159 insertions(+), 66 deletions(-) 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 d99e60eb5d53..dbb88c1696ae 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 (v25.3.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.1), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation @@ -597,6 +597,8 @@ open class WebKitLibraryPigeonProxyApiRegistrar { binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) PigeonApiURLCredential.setUpMessageHandlers( binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) + PigeonApiURLProtectionSpace.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) PigeonApiURL.setUpMessageHandlers( @@ -632,6 +634,7 @@ open class WebKitLibraryPigeonProxyApiRegistrar { PigeonApiWKHTTPCookieStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( binaryMessenger: binaryMessenger, api: nil) PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -6748,6 +6751,35 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace? + ) { + let codec: FlutterStandardMessageCodec = + api != nil + ? FlutterStandardMessageCodec( + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) + : FlutterStandardMessageCodec.sharedInstance() + let getServerTrustChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getServerTrustChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! URLProtectionSpace + do { + let result = try api.pigeonDelegate.getServerTrust( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + getServerTrustChannel.setMessageHandler(nil) + } + } + ///Creates a Dart instance of URLProtectionSpace and attaches it to [pigeonInstance]. func pigeonNewInstance( pigeonInstance: URLProtectionSpace, completion: @escaping (Result) -> Void @@ -6768,8 +6800,6 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { let realmArg = try! pigeonDelegate.realm(pigeonApi: self, pigeonInstance: pigeonInstance) let authenticationMethodArg = try! pigeonDelegate.authenticationMethod( pigeonApi: self, pigeonInstance: pigeonInstance) - let getServerTrustArg = try! pigeonDelegate.getServerTrust( - pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = @@ -6777,10 +6807,7 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { let channel = FlutterBasicMessageChannel( name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage( - [ - pigeonIdentifierArg, hostArg, portArg, realmArg, authenticationMethodArg, - getServerTrustArg, - ] as [Any?] + [pigeonIdentifierArg, hostArg, portArg, realmArg, authenticationMethodArg] as [Any?] ) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) 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 5d3f3ee1fe72..c6a9598d1e0a 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 (v25.3.0), do not edit directly. +// Autogenerated from Pigeon (v25.3.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 @@ -7644,10 +7644,13 @@ class URLProtectionSpace extends NSObject { required this.port, this.realm, this.authenticationMethod, - this.getServerTrust, super.observeValue, }) : super.pigeon_detached(); + late final _PigeonInternalProxyApiBaseCodec + _pigeonVar_codecURLProtectionSpace = + _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); + /// The receiver’s host. final String host; @@ -7660,9 +7663,6 @@ class URLProtectionSpace extends NSObject { /// The authentication method used by the receiver. final String? authenticationMethod; - /// A representation of the server’s SSL transaction state. - final SecTrust? getServerTrust; - static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, @@ -7672,7 +7672,6 @@ class URLProtectionSpace extends NSObject { int port, String? realm, String? authenticationMethod, - SecTrust? getServerTrust, )? pigeon_newInstance, }) { final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = @@ -7704,12 +7703,11 @@ class URLProtectionSpace extends NSObject { 'Argument for dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.pigeon_newInstance was null, expected non-null int.'); final String? arg_realm = (args[3] as String?); final String? arg_authenticationMethod = (args[4] as String?); - final SecTrust? arg_getServerTrust = (args[5] as SecTrust?); try { (pigeon_instanceManager ?? PigeonInstanceManager.instance) .addHostCreatedInstance( pigeon_newInstance?.call(arg_host!, arg_port!, arg_realm, - arg_authenticationMethod, arg_getServerTrust) ?? + arg_authenticationMethod) ?? URLProtectionSpace.pigeon_detached( pigeon_binaryMessenger: pigeon_binaryMessenger, pigeon_instanceManager: pigeon_instanceManager, @@ -7717,7 +7715,6 @@ class URLProtectionSpace extends NSObject { port: arg_port!, realm: arg_realm, authenticationMethod: arg_authenticationMethod, - getServerTrust: arg_getServerTrust, ), arg_pigeon_instanceIdentifier!, ); @@ -7733,6 +7730,36 @@ class URLProtectionSpace extends NSObject { } } + /// A representation of the server’s SSL transaction state. + Future getServerTrust() async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecURLProtectionSpace; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([this]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture 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 (pigeonVar_replyList[0] as SecTrust?); + } + } + @override URLProtectionSpace pigeon_copy() { return URLProtectionSpace.pigeon_detached( @@ -7742,7 +7769,6 @@ class URLProtectionSpace extends NSObject { port: port, realm: realm, authenticationMethod: authenticationMethod, - getServerTrust: getServerTrust, observeValue: observeValue, ); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/webkit_constants.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/webkit_constants.dart index 281df86ce5e6..6dc413e0cb7b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/webkit_constants.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/webkit_constants.dart @@ -69,4 +69,8 @@ class NSUrlAuthenticationMethod { /// Use NTLM authentication for this protection space. static const String httpNtlm = 'NSURLAuthenticationMethodNTLM'; + + /// Perform server trust authentication (certificate validation) for this + /// protection space. + static const String serverTrust = 'NSURLAuthenticationMethodServerTrust'; } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart index fcb27f67caa9..d54417b23f8a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart @@ -7,9 +7,10 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte import 'common/web_kit.g.dart'; class WebKitSslAuthRequest extends PlatformSslAuthRequest { - WebKitSslAuthRequest({ + WebKitSslAuthRequest._({ required super.certificates, required SecTrust trust, + required this.host, required void Function( UrlSessionAuthChallengeDisposition disposition, Map? credentialMap, @@ -24,8 +25,11 @@ class WebKitSslAuthRequest extends PlatformSslAuthRequest { Map? credentialMap, ) _onResponse; + final String host; + static Future fromTrust({ required SecTrust trust, + required String host, required void Function( UrlSessionAuthChallengeDisposition disposition, Map? credentialMap, @@ -56,13 +60,14 @@ class WebKitSslAuthRequest extends PlatformSslAuthRequest { final List certificates = (await SecTrust.copyCertificateChain(trust)) ?? []; if (trusted) { - return WebKitSslAuthRequest( + return WebKitSslAuthRequest._( certificates: await fromNativeCertificates(certificates), trust: trust, + host: host, onResponse: onResponse, ); } else { - return WebKitSslAuthRequest( + return WebKitSslAuthRequest._( certificates: await fromNativeCertificates( certificates, [ @@ -72,6 +77,7 @@ class WebKitSslAuthRequest extends PlatformSslAuthRequest { ], ), trust: trust, + host: host, onResponse: onResponse, ); } @@ -79,7 +85,7 @@ class WebKitSslAuthRequest extends PlatformSslAuthRequest { final List certificates = (await SecTrust.copyCertificateChain(trust)) ?? []; - return WebKitSslAuthRequest( + return WebKitSslAuthRequest._( certificates: await fromNativeCertificates( certificates, [ @@ -89,6 +95,7 @@ class WebKitSslAuthRequest extends PlatformSslAuthRequest { ], ), trust: trust, + host: host, onResponse: onResponse, ); } 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 57f188e9e719..08bfecf9ff98 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 @@ -16,6 +16,7 @@ import 'common/weak_reference_utils.dart'; import 'common/web_kit.g.dart'; import 'common/webkit_constants.dart'; import 'webkit_proxy.dart'; +import 'webkit_ssl_auth_request.dart'; /// Media types that can require a user gesture to begin playing. /// @@ -1233,57 +1234,77 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { __, URLAuthenticationChallenge challenge, ) async { - final URLProtectionSpace protectionSpace = - await challenge.getProtectionSpace(); - - final bool isBasicOrNtlm = protectionSpace.authenticationMethod == - NSUrlAuthenticationMethod.httpBasic || - protectionSpace.authenticationMethod == - NSUrlAuthenticationMethod.httpNtlm; - - final void Function(HttpAuthRequest)? callback = - weakThis.target?._onHttpAuthRequest; - - final WebKitProxy? proxy = - (weakThis.target?.params as WebKitNavigationDelegateCreationParams?) - ?.webKitProxy; - - if (isBasicOrNtlm && callback != null && proxy != null) { - final String host = protectionSpace.host; - final String? realm = protectionSpace.realm; - + final WebKitNavigationDelegate? delegate = weakThis.target; + + if (delegate != null) { + final URLProtectionSpace protectionSpace = + await challenge.getProtectionSpace(); + final WebKitProxy proxy = + (delegate.params as WebKitNavigationDelegateCreationParams) + .webKitProxy; final Completer> responseCompleter = Completer>(); - callback( - HttpAuthRequest( - host: host, - realm: realm, - onProceed: (WebViewCredential credential) { - responseCompleter.complete( - [ - UrlSessionAuthChallengeDisposition.useCredential, - { - 'user': credential.user, - 'password': credential.password, - 'persistence': UrlCredentialPersistence.forSession, + switch (protectionSpace.authenticationMethod) { + case NSUrlAuthenticationMethod.httpBasic: + case NSUrlAuthenticationMethod.httpNtlm: + final void Function(HttpAuthRequest)? callback = + delegate._onHttpAuthRequest; + if (callback != null) { + callback( + HttpAuthRequest( + host: protectionSpace.host, + realm: protectionSpace.realm, + onProceed: (WebViewCredential credential) { + responseCompleter.complete( + [ + UrlSessionAuthChallengeDisposition.useCredential, + { + 'user': credential.user, + 'password': credential.password, + 'persistence': UrlCredentialPersistence.forSession, + }, + ], + ); }, - ], + onCancel: () { + responseCompleter.complete( + [ + UrlSessionAuthChallengeDisposition + .cancelAuthenticationChallenge, + null, + ], + ); + }, + ), ); - }, - onCancel: () { - responseCompleter.complete( - [ - UrlSessionAuthChallengeDisposition - .cancelAuthenticationChallenge, - null, - ], + + return responseCompleter.future; + } + case NSUrlAuthenticationMethod.serverTrust: + final void Function(PlatformSslAuthRequest)? callback = + delegate._onSslAuthRequest; + final SecTrust? serverTrust = + await protectionSpace.getServerTrust(); + if (callback != null && serverTrust != null) { + callback( + await WebKitSslAuthRequest.fromTrust( + trust: serverTrust, + host: protectionSpace.host, + onResponse: ( + UrlSessionAuthChallengeDisposition disposition, + Map? credentialMap, + ) { + responseCompleter.complete( + [disposition, credentialMap], + ); + }, + ), ); - }, - ), - ); - return responseCompleter.future; + return responseCompleter.future; + } + } } return [ @@ -1305,6 +1326,7 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { NavigationRequestCallback? _onNavigationRequest; UrlChangeCallback? _onUrlChange; HttpAuthRequestCallback? _onHttpAuthRequest; + SslAuthRequestCallback? _onSslAuthRequest; @override Future setOnPageFinished(PageEventCallback onPageFinished) async { @@ -1351,6 +1373,13 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { ) async { _onHttpAuthRequest = onHttpAuthRequest; } + + @override + Future setOnSSlAuthRequest( + SslAuthRequestCallback onSslAuthRequest, + ) async { + _onSslAuthRequest = onSslAuthRequest; + } } /// WebKit implementation of [PlatformWebViewPermissionRequest]. 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 0cf38a4e9ee2..8f567b9335dd 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -1142,7 +1142,7 @@ abstract class URLProtectionSpace extends NSObject { late String? authenticationMethod; /// A representation of the server’s SSL transaction state. - late SecTrust? getServerTrust; + SecTrust? getServerTrust(); } /// A challenge from a server requiring authentication from the client. From 945763dce9b26368f59ba9964b009022c0234980 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 00:22:13 -0400 Subject: [PATCH 10/34] start of front facing but need to restart --- .../lib/src/navigation_delegate.dart | 49 +++++++++++++++++++ .../lib/src/android_ssl_auth_request.dart | 5 ++ .../lib/src/platform_ssl_auth_request.dart | 4 ++ .../lib/src/webkit_ssl_auth_request.dart | 11 +++-- 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart index 746caed140d5..682e1c072cb8 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart @@ -51,6 +51,7 @@ class NavigationDelegate { void Function(UrlChange change)? onUrlChange, void Function(HttpAuthRequest request)? onHttpAuthRequest, void Function(HttpResponseError error)? onHttpError, + void Function(SslAuthRequest request)? onSslAuthRequest, }) : this.fromPlatformCreationParams( const PlatformNavigationDelegateCreationParams(), onNavigationRequest: onNavigationRequest, @@ -61,6 +62,7 @@ class NavigationDelegate { onUrlChange: onUrlChange, onHttpAuthRequest: onHttpAuthRequest, onHttpError: onHttpError, + onSslAuthRequest: onSslAuthRequest, ); /// Constructs a [NavigationDelegate] from creation params for a specific @@ -105,6 +107,7 @@ class NavigationDelegate { void Function(UrlChange change)? onUrlChange, void Function(HttpAuthRequest request)? onHttpAuthRequest, void Function(HttpResponseError error)? onHttpError, + void Function(SslAuthRequest request)? onSslAuthRequest, }) : this.fromPlatform( PlatformNavigationDelegate(params), onNavigationRequest: onNavigationRequest, @@ -115,6 +118,7 @@ class NavigationDelegate { onUrlChange: onUrlChange, onHttpAuthRequest: onHttpAuthRequest, onHttpError: onHttpError, + onSslAuthRequest: onSslAuthRequest, ); /// Constructs a [NavigationDelegate] from a specific platform implementation. @@ -130,6 +134,7 @@ class NavigationDelegate { void Function(UrlChange change)? onUrlChange, HttpAuthRequestCallback? onHttpAuthRequest, void Function(HttpResponseError error)? onHttpError, + void Function(SslAuthRequest request)? onSslAuthRequest, }) { if (onNavigationRequest != null) { platform.setOnNavigationRequest(onNavigationRequest!); @@ -155,6 +160,13 @@ class NavigationDelegate { if (onHttpError != null) { platform.setOnHttpError(onHttpError); } + if (onSslAuthRequest != null) { + platform.setOnSSlAuthRequest( + (PlatformSslAuthRequest request) { + onSslAuthRequest(SslAuthRequest._fromPlatform(request)); + }, + ); + } } /// Implementation of [PlatformNavigationDelegate] for the current platform. @@ -184,3 +196,40 @@ class NavigationDelegate { /// Invoked when a resource loading error occurred. final WebResourceErrorCallback? onWebResourceError; } + +/// A request from a server to respond to a set of one or more SSL errors with +/// the associated SSL certificate. +/// +/// The host application must call [cancel], [proceed], or choose an option +/// provided by by the platform implementation. +/// +/// ## Platform-Specific Features +/// This class contains an underlying implementation provided by the current +/// platform. Once a platform implementation is imported, the examples below +/// can be followed to use features provided by a platform's implementation. +/// +/// Below is an example of accessing the platform-specific implementation for +/// iOS and Android: +/// +/// ```dart +/// final SslAuthRequest request = ...; +/// +/// if (WebViewPlatform.instance is WebKitWebViewPlatform) { +/// final WebKitSslAuthRequest webKitRequest = +/// request.platform as WebKitSslAuthRequest; +/// } else if (WebViewPlatform.instance is AndroidWebViewPlatform) { +/// final AndroidSslAuthRequest androidRequest = +/// request.platform as AndroidSslAuthRequest; +/// } +/// ``` +class SslAuthRequest { + SslAuthRequest._fromPlatform(this.platform); + + final PlatformSslAuthRequest platform; + + List get certificate => platform.certificates; + + Future cancel() => platform.cancel(); + + Future proceed() => platform.proceed(); +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart index a87e8800335c..f164c3468abd 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart @@ -49,4 +49,9 @@ class AndroidSslAuthRequest extends PlatformSslAuthRequest { @override Future proceed() => _handler.proceed(); + + @override + Future defaultHandling() { + return _handler.cancel(); + } } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart index 8ced02faf1a0..0af89fbf3508 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart @@ -33,4 +33,8 @@ abstract class PlatformSslAuthRequest { /// Instructs the WebView that encountered the SSL certificate error to /// terminate communication with the server. Future cancel(); + + /// Instructs the WebView that encountered the SSL certificate error to use + /// the system-provided default behavior. + Future defaultHandling(); } diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart index d54417b23f8a..1a90b8aaa367 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart @@ -53,10 +53,6 @@ class WebKitSslAuthRequest extends PlatformSslAuthRequest { try { final bool trusted = await SecTrust.evaluateWithError(trust); - // Since this is expected to be an auth request for an invalid - // certificate, the method above is expected to throw with an error - // message. However, this handles the scenario where the certificate is - // valid or doesn't throw just in case. final List certificates = (await SecTrust.copyCertificateChain(trust)) ?? []; if (trusted) { @@ -101,6 +97,13 @@ class WebKitSslAuthRequest extends PlatformSslAuthRequest { } } + Future performDefaultHandling() async { + _onResponse( + UrlSessionAuthChallengeDisposition.performDefaultHandling, + null, + ); + } + @override Future cancel() async { _onResponse( From 16c5e2544ff1f7d43d55cbef40bd1b8f7468ba89 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:08:38 -0400 Subject: [PATCH 11/34] update platform interface --- .../lib/src/android_ssl_auth_request.dart | 3 +++ .../lib/src/platform_navigation_delegate.dart | 13 +++++----- .../lib/src/platform_ssl_auth_request.dart | 24 +++++++------------ .../lib/src/types/ssl_certificate.dart | 20 ---------------- .../lib/src/types/ssl_error.dart | 15 ------------ .../lib/src/types/types.dart | 3 +-- .../lib/src/types/x509_certificate.dart | 15 ++++++++++++ 7 files changed, 34 insertions(+), 59 deletions(-) delete mode 100644 packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_certificate.dart delete mode 100644 packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_error.dart create mode 100644 packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/x509_certificate.dart diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart index f164c3468abd..60467395252c 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart @@ -44,6 +44,9 @@ class AndroidSslAuthRequest extends PlatformSslAuthRequest { final android.SslErrorHandler _handler; + // /// The URL associated with the request. + // final Uri? url; + @override Future cancel() => _handler.cancel(); diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart index 7b949624067c..187e6cee443f 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart @@ -35,9 +35,9 @@ typedef UrlChangeCallback = void Function(UrlChange change); /// authentication request. typedef HttpAuthRequestCallback = void Function(HttpAuthRequest request); -/// Signature for callbacks that notify the host application of an -/// SSL authentication request. -typedef SslAuthRequestCallback = void Function(PlatformSslAuthRequest request); +/// Signature for callbacks that notify the host application of an SSL +/// authentication error. +typedef SslAuthErrorCallback = void Function(PlatformSslAuthError error); /// An interface defining navigation events that occur on the native platform. /// @@ -149,10 +149,11 @@ abstract class PlatformNavigationDelegate extends PlatformInterface { ); } - /// Invoked when the web view requests a response to an SSL error. - Future setOnSSlAuthRequest(SslAuthRequestCallback onSslAuthRequest) { + /// Invoked when the web view receives a recoverable SSL error for a + /// certificate. + Future setOnSSlAuthError(SslAuthErrorCallback onSslAuthError) { throw UnimplementedError( - 'setOnSSlAuthRequest is not implemented on the current platform.', + 'setOnSSlAuthError is not implemented on the current platform.', ); } } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart index 0af89fbf3508..cdb99f7b6323 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart @@ -6,25 +6,21 @@ import 'package:flutter/foundation.dart'; import 'types/types.dart'; -/// A request from a server to respond to a set of one or more SSL errors with -/// the associated SSL certificate. +/// Represents an SSL error with the associated certificate. /// /// The host application must call [cancel] or, contrary to secure web /// communication standards, [proceed] to provide the web view's response to the /// request. -abstract class PlatformSslAuthRequest { - /// Creates a [PlatformSslAuthRequest]. +abstract class PlatformSslAuthError { + /// Creates a [PlatformSslAuthError]. @protected - PlatformSslAuthRequest({ - required this.certificates, - this.url, - }); + PlatformSslAuthError({required this.certificate, required this.description}); - /// A list of certificates associated with this request. - final List certificates; + /// The certificate associated with this error. + final X509Certificate? certificate; - /// The URL associated with the request. - final Uri? url; + /// A human-presentable description for a given error. + final String description; /// Instructs the WebView that encountered the SSL certificate error to ignore /// the error and continue communicating with the server. @@ -33,8 +29,4 @@ abstract class PlatformSslAuthRequest { /// Instructs the WebView that encountered the SSL certificate error to /// terminate communication with the server. Future cancel(); - - /// Instructs the WebView that encountered the SSL certificate error to use - /// the system-provided default behavior. - Future defaultHandling(); } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_certificate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_certificate.dart deleted file mode 100644 index 496bb3632da8..000000000000 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_certificate.dart +++ /dev/null @@ -1,20 +0,0 @@ -// 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 'package:flutter/foundation.dart'; - -import 'ssl_error.dart'; - -/// Provides the details for an SSL certificate. -@immutable -class SslCertificate { - /// Creates a [SslCertificate]. - const SslCertificate({this.data, this.errors = const []}); - - /// The encoded form of this certificate. - final Uint8List? data; - - /// A list of errors associated with this certificate. - final List errors; -} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_error.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_error.dart deleted file mode 100644 index b07fbd6c0141..000000000000 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/ssl_error.dart +++ /dev/null @@ -1,15 +0,0 @@ -// 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 'package:flutter/foundation.dart'; - -/// Provides the details for an SSl certificate error. -@immutable -class SslError { - /// Creates an [SslError]. - const SslError({required this.description}); - - /// A human-presentable description for a given error. - final String description; -} diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart index 731cca24bf2f..bc4e9a867209 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/types.dart @@ -19,11 +19,10 @@ export 'platform_webview_cookie_manager_creation_params.dart'; export 'platform_webview_permission_request.dart'; export 'platform_webview_widget_creation_params.dart'; export 'scroll_position_change.dart'; -export 'ssl_certificate.dart'; -export 'ssl_error.dart'; export 'url_change.dart'; export 'web_resource_error.dart'; export 'web_resource_request.dart'; export 'web_resource_response.dart'; export 'webview_cookie.dart'; export 'webview_credential.dart'; +export 'x509_certificate.dart'; diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/x509_certificate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/x509_certificate.dart new file mode 100644 index 000000000000..f4ca0cd6fe18 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/x509_certificate.dart @@ -0,0 +1,15 @@ +// 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 'package:flutter/foundation.dart'; + +/// Represents an X.509 certificate. +@immutable +class X509Certificate { + /// Creates an [X509Certificate]. + const X509Certificate({this.data}); + + /// A DER representation of the certificate object. + final Uint8List? data; +} From 92c60789a58919b9b208f506f0021959bd9402ce Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:17:32 -0400 Subject: [PATCH 12/34] android impl --- ...quest.dart => android_ssl_auth_error.dart} | 50 +++++++++---------- .../lib/src/android_webview_controller.dart | 22 ++++---- .../lib/webview_flutter_android.dart | 1 + .../lib/src/platform_navigation_delegate.dart | 2 +- ...uest.dart => platform_ssl_auth_error.dart} | 0 .../webview_flutter_platform_interface.dart | 2 +- 6 files changed, 37 insertions(+), 40 deletions(-) rename packages/webview_flutter/webview_flutter_android/lib/src/{android_ssl_auth_request.dart => android_ssl_auth_error.dart} (68%) rename packages/webview_flutter/webview_flutter_platform_interface/lib/src/{platform_ssl_auth_request.dart => platform_ssl_auth_error.dart} (100%) diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_error.dart similarity index 68% rename from packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart rename to packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_error.dart index 60467395252c..185c3c5ee12e 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_request.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_error.dart @@ -5,12 +5,23 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'android_webkit.g.dart' as android; -class AndroidSslCertificate extends SslCertificate { - AndroidSslCertificate._({super.data, super.errors}); +class AndroidSslAuthError extends PlatformSslAuthError { + AndroidSslAuthError({ + required super.certificate, + required super.description, + required android.SslErrorHandler handler, + required this.url, + }) : _handler = handler; + + final android.SslErrorHandler _handler; - static Future fromNativeSslError( - android.SslError error, - ) async { + /// The URL associated with the error. + final String url; + + static Future fromNativeSslError({ + required android.SslError error, + required android.SslErrorHandler handler, + }) async { final android.SslCertificate certificate = error.certificate; final android.X509Certificate? x509Certificate = await certificate.getX509Certificate(); @@ -28,33 +39,20 @@ class AndroidSslCertificate extends SslCertificate { android.SslErrorType.unknown => 'The certificate has an unknown error.', }; - return AndroidSslCertificate._( - data: x509Certificate != null ? await x509Certificate.getEncoded() : null, - errors: [SslError(description: errorDescription)], + return AndroidSslAuthError( + certificate: X509Certificate( + data: + x509Certificate != null ? await x509Certificate.getEncoded() : null, + ), + handler: handler, + description: errorDescription, + url: error.url, ); } -} - -class AndroidSslAuthRequest extends PlatformSslAuthRequest { - AndroidSslAuthRequest({ - required android.SslErrorHandler handler, - required super.certificates, - super.url, - }) : _handler = handler; - - final android.SslErrorHandler _handler; - - // /// The URL associated with the request. - // final Uri? url; @override Future cancel() => _handler.cancel(); @override Future proceed() => _handler.proceed(); - - @override - Future defaultHandling() { - return _handler.cancel(); - } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index f165d10c16a2..df3e79c5561a 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -12,7 +12,7 @@ import 'package:flutter/services.dart'; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'android_proxy.dart'; -import 'android_ssl_auth_request.dart'; +import 'android_ssl_auth_error.dart'; import 'android_webkit.g.dart' as android_webview; import 'android_webkit_constants.dart'; import 'platform_views_service_proxy.dart'; @@ -1486,18 +1486,17 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { android_webview.SslErrorHandler handler, android_webview.SslError error, ) async { - final void Function(PlatformSslAuthRequest)? callback = - weakThis.target?._onSslAuthRequest; + final void Function(PlatformSslAuthError)? callback = + weakThis.target?._onSslAuthError; if (callback != null) { - final AndroidSslAuthRequest authRequest = AndroidSslAuthRequest( + final AndroidSslAuthError authError = + await AndroidSslAuthError.fromNativeSslError( + error: error, handler: handler, - certificates: [ - await AndroidSslCertificate.fromNativeSslError(error), - ], ); - callback(authRequest); + callback(authError); } else { await handler.cancel(); } @@ -1564,7 +1563,7 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { LoadRequestCallback? _onLoadRequest; UrlChangeCallback? _onUrlChange; HttpAuthRequestCallback? _onHttpAuthRequest; - SslAuthRequestCallback? _onSslAuthRequest; + SslAuthErrorCallback? _onSslAuthError; void _handleNavigation( String url, { @@ -1671,8 +1670,7 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { } @override - Future setOnSSlAuthRequest( - SslAuthRequestCallback onSslAuthRequest) async { - _onSslAuthRequest = onSslAuthRequest; + Future setOnSSlAuthError(SslAuthErrorCallback onSslAuthError) async { + _onSslAuthError = onSslAuthError; } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/webview_flutter_android.dart b/packages/webview_flutter/webview_flutter_android/lib/webview_flutter_android.dart index a9297fa43cb1..6c3a3e4248f9 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/webview_flutter_android.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/webview_flutter_android.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +export 'src/android_ssl_auth_error.dart'; export 'src/android_webview_controller.dart'; export 'src/android_webview_cookie_manager.dart'; export 'src/android_webview_platform.dart'; diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart index 187e6cee443f..8e4dad010cfa 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart @@ -6,7 +6,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; -import 'platform_ssl_auth_request.dart'; +import 'platform_ssl_auth_error.dart'; import 'types/types.dart'; import 'webview_platform.dart' show WebViewPlatform; diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_error.dart similarity index 100% rename from packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_request.dart rename to packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_error.dart diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/webview_flutter_platform_interface.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/webview_flutter_platform_interface.dart index afd4f1aee047..47c2ad261b89 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/webview_flutter_platform_interface.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/webview_flutter_platform_interface.dart @@ -3,7 +3,7 @@ // found in the LICENSE file. export 'src/platform_navigation_delegate.dart'; -export 'src/platform_ssl_auth_request.dart'; +export 'src/platform_ssl_auth_error.dart'; export 'src/platform_webview_controller.dart'; export 'src/platform_webview_cookie_manager.dart'; export 'src/platform_webview_widget.dart'; From 7c145c417f67444390b60a4ca446358e2f61fb34 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:57:35 -0400 Subject: [PATCH 13/34] ios impl --- .../lib/src/webkit_ssl_auth_error.dart | 55 ++++++++ .../lib/src/webkit_ssl_auth_request.dart | 122 ------------------ .../lib/src/webkit_webview_controller.dart | 79 ++++++++---- 3 files changed, 110 insertions(+), 146 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart delete mode 100644 packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart new file mode 100644 index 000000000000..ca86f86b8eba --- /dev/null +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart @@ -0,0 +1,55 @@ +// 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 'package:flutter/services.dart'; +import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; +import 'common/web_kit.g.dart'; + +class WebKitSslAuthError extends PlatformSslAuthError { + WebKitSslAuthError({ + required super.certificate, + required super.description, + required SecTrust trust, + required this.host, + required this.port, + required void Function( + UrlSessionAuthChallengeDisposition disposition, + Map? credentialMap, + ) onResponse, + }) : _trust = trust, + _onResponse = onResponse; + + final SecTrust _trust; + + final void Function( + UrlSessionAuthChallengeDisposition disposition, + Map? credentialMap, + ) _onResponse; + + /// The host portion of the url associated with the error. + final String host; + + /// The port portion of the url associated with the error. + final int port; + + @override + Future cancel() async { + _onResponse( + UrlSessionAuthChallengeDisposition.cancelAuthenticationChallenge, + null, + ); + } + + @override + Future proceed() async { + final Uint8List? exceptions = await SecTrust.copyExceptions(_trust); + if (exceptions != null) { + await SecTrust.setExceptions(_trust, exceptions); + } + _onResponse( + UrlSessionAuthChallengeDisposition.useCredential, + {'serverTrust': _trust}, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart deleted file mode 100644 index 1a90b8aaa367..000000000000 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_request.dart +++ /dev/null @@ -1,122 +0,0 @@ -// 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 'package:flutter/services.dart'; -import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; -import 'common/web_kit.g.dart'; - -class WebKitSslAuthRequest extends PlatformSslAuthRequest { - WebKitSslAuthRequest._({ - required super.certificates, - required SecTrust trust, - required this.host, - required void Function( - UrlSessionAuthChallengeDisposition disposition, - Map? credentialMap, - ) onResponse, - }) : _trust = trust, - _onResponse = onResponse; - - final SecTrust _trust; - - final void Function( - UrlSessionAuthChallengeDisposition disposition, - Map? credentialMap, - ) _onResponse; - - final String host; - - static Future fromTrust({ - required SecTrust trust, - required String host, - required void Function( - UrlSessionAuthChallengeDisposition disposition, - Map? credentialMap, - ) onResponse, - }) async { - // Converts a list native certificate objects to a list of platform - // interface certificates. - Future> fromNativeCertificates( - List certificates, [ - List errors = const [], - ]) async { - return [ - for (final SecCertificate certificate in certificates) - SslCertificate( - data: await SecCertificate.copyData(certificate), - errors: errors, - ), - ]; - } - - try { - final bool trusted = await SecTrust.evaluateWithError(trust); - - final List certificates = - (await SecTrust.copyCertificateChain(trust)) ?? []; - if (trusted) { - return WebKitSslAuthRequest._( - certificates: await fromNativeCertificates(certificates), - trust: trust, - host: host, - onResponse: onResponse, - ); - } else { - return WebKitSslAuthRequest._( - certificates: await fromNativeCertificates( - certificates, - [ - const SslError( - description: 'Certificate failed evaluation.', - ) - ], - ), - trust: trust, - host: host, - onResponse: onResponse, - ); - } - } on PlatformException catch (exception) { - final List certificates = - (await SecTrust.copyCertificateChain(trust)) ?? []; - - return WebKitSslAuthRequest._( - certificates: await fromNativeCertificates( - certificates, - [ - SslError( - description: '${exception.code}: ${exception.message ?? ''}', - ) - ], - ), - trust: trust, - host: host, - onResponse: onResponse, - ); - } - } - - Future performDefaultHandling() async { - _onResponse( - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ); - } - - @override - Future cancel() async { - _onResponse( - UrlSessionAuthChallengeDisposition.cancelAuthenticationChallenge, - null, - ); - } - - @override - Future proceed() async { - _onResponse( - UrlSessionAuthChallengeDisposition.useCredential, - {'serverTrust': _trust}, - ); - } -} 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 08bfecf9ff98..d9a1c0504410 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 @@ -16,7 +16,7 @@ import 'common/weak_reference_utils.dart'; import 'common/web_kit.g.dart'; import 'common/webkit_constants.dart'; import 'webkit_proxy.dart'; -import 'webkit_ssl_auth_request.dart'; +import 'webkit_ssl_auth_error.dart'; /// Media types that can require a user gesture to begin playing. /// @@ -1282,27 +1282,60 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { return responseCompleter.future; } case NSUrlAuthenticationMethod.serverTrust: - final void Function(PlatformSslAuthRequest)? callback = - delegate._onSslAuthRequest; + final void Function(PlatformSslAuthError)? callback = + delegate._onSslAuthError; + if (callback == null) { + break; + } + final SecTrust? serverTrust = await protectionSpace.getServerTrust(); - if (callback != null && serverTrust != null) { - callback( - await WebKitSslAuthRequest.fromTrust( - trust: serverTrust, - host: protectionSpace.host, - onResponse: ( - UrlSessionAuthChallengeDisposition disposition, - Map? credentialMap, - ) { - responseCompleter.complete( - [disposition, credentialMap], - ); - }, - ), - ); + if (serverTrust == null) { + break; + } - return responseCompleter.future; + try { + final bool trusted = + await SecTrust.evaluateWithError(serverTrust); + if (!trusted) { + throw StateError( + 'Expected to throw an exception when evaluation fails.', + ); + } + } on PlatformException catch (exception) { + final DartSecTrustResultType result = + (await SecTrust.getTrustResult(serverTrust)).result; + if (result == DartSecTrustResultType.recoverableTrustFailure) { + final List certificates = + (await SecTrust.copyCertificateChain(serverTrust)) ?? + []; + + final SecCertificate? leafCertificate = + certificates.firstOrNull; + if (leafCertificate != null) { + callback( + WebKitSslAuthError( + certificate: X509Certificate( + data: await SecCertificate.copyData(leafCertificate), + ), + description: '${exception.code}: ${exception.message}', + trust: serverTrust, + host: protectionSpace.host, + port: protectionSpace.port, + onResponse: ( + UrlSessionAuthChallengeDisposition disposition, + Map? credentialMap, + ) { + responseCompleter.complete( + [disposition, credentialMap], + ); + }, + ), + ); + + return responseCompleter.future; + } + } } } } @@ -1326,7 +1359,7 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { NavigationRequestCallback? _onNavigationRequest; UrlChangeCallback? _onUrlChange; HttpAuthRequestCallback? _onHttpAuthRequest; - SslAuthRequestCallback? _onSslAuthRequest; + SslAuthErrorCallback? _onSslAuthError; @override Future setOnPageFinished(PageEventCallback onPageFinished) async { @@ -1375,10 +1408,8 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { } @override - Future setOnSSlAuthRequest( - SslAuthRequestCallback onSslAuthRequest, - ) async { - _onSslAuthRequest = onSslAuthRequest; + Future setOnSSlAuthError(SslAuthErrorCallback onSslAuthError) async { + _onSslAuthError = onSslAuthError; } } From d3e43a48be7d05ca8ebe2c455b566b279758faef Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 18:13:18 -0400 Subject: [PATCH 14/34] webview_flutter impl --- .../lib/src/navigation_delegate.dart | 64 ++++++++++++------- .../lib/src/platform_navigation_delegate.dart | 3 + .../lib/src/platform_ssl_auth_error.dart | 7 ++ .../lib/src/webkit_webview_controller.dart | 48 +++++++------- 4 files changed, 75 insertions(+), 47 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart index 682e1c072cb8..d93b1bbe981c 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart @@ -38,8 +38,11 @@ class NavigationDelegate { /// Constructs a [NavigationDelegate]. /// /// {@template webview_fluttter.NavigationDelegate.constructor} - /// `onUrlChange`: invoked when the underlying web view changes to a new url. - /// `onHttpAuthRequest`: invoked when the web view is requesting authentication. + /// **`onUrlChange`:** invoked when the underlying web view changes to a new url. + /// **`onHttpAuthRequest`:** invoked when the web view is requesting authentication. + /// **`onSslAuthError`:** Invoked when the web view receives a recoverable SSL + /// error for a certificate. The host application must call either + /// [SslAuthError.cancel] or [SslAuthError.proceed]. /// {@endtemplate} NavigationDelegate({ FutureOr Function(NavigationRequest request)? @@ -51,7 +54,7 @@ class NavigationDelegate { void Function(UrlChange change)? onUrlChange, void Function(HttpAuthRequest request)? onHttpAuthRequest, void Function(HttpResponseError error)? onHttpError, - void Function(SslAuthRequest request)? onSslAuthRequest, + void Function(SslAuthError request)? onSslAuthError, }) : this.fromPlatformCreationParams( const PlatformNavigationDelegateCreationParams(), onNavigationRequest: onNavigationRequest, @@ -62,7 +65,7 @@ class NavigationDelegate { onUrlChange: onUrlChange, onHttpAuthRequest: onHttpAuthRequest, onHttpError: onHttpError, - onSslAuthRequest: onSslAuthRequest, + onSslAuthError: onSslAuthError, ); /// Constructs a [NavigationDelegate] from creation params for a specific @@ -107,7 +110,7 @@ class NavigationDelegate { void Function(UrlChange change)? onUrlChange, void Function(HttpAuthRequest request)? onHttpAuthRequest, void Function(HttpResponseError error)? onHttpError, - void Function(SslAuthRequest request)? onSslAuthRequest, + void Function(SslAuthError request)? onSslAuthError, }) : this.fromPlatform( PlatformNavigationDelegate(params), onNavigationRequest: onNavigationRequest, @@ -118,7 +121,7 @@ class NavigationDelegate { onUrlChange: onUrlChange, onHttpAuthRequest: onHttpAuthRequest, onHttpError: onHttpError, - onSslAuthRequest: onSslAuthRequest, + onSslAuthError: onSslAuthError, ); /// Constructs a [NavigationDelegate] from a specific platform implementation. @@ -134,7 +137,7 @@ class NavigationDelegate { void Function(UrlChange change)? onUrlChange, HttpAuthRequestCallback? onHttpAuthRequest, void Function(HttpResponseError error)? onHttpError, - void Function(SslAuthRequest request)? onSslAuthRequest, + void Function(SslAuthError request)? onSslAuthError, }) { if (onNavigationRequest != null) { platform.setOnNavigationRequest(onNavigationRequest!); @@ -160,10 +163,10 @@ class NavigationDelegate { if (onHttpError != null) { platform.setOnHttpError(onHttpError); } - if (onSslAuthRequest != null) { - platform.setOnSSlAuthRequest( - (PlatformSslAuthRequest request) { - onSslAuthRequest(SslAuthRequest._fromPlatform(request)); + if (onSslAuthError != null) { + platform.setOnSSlAuthError( + (PlatformSslAuthError request) { + onSslAuthError(SslAuthError._fromPlatform(request)); }, ); } @@ -197,11 +200,11 @@ class NavigationDelegate { final WebResourceErrorCallback? onWebResourceError; } -/// A request from a server to respond to a set of one or more SSL errors with -/// the associated SSL certificate. +/// Represents an SSL error with the associated certificate. /// -/// The host application must call [cancel], [proceed], or choose an option -/// provided by by the platform implementation. +/// The host application must call [cancel] or, contrary to secure web +/// communication standards, [proceed] to provide the web view's response to the +/// request. /// /// ## Platform-Specific Features /// This class contains an underlying implementation provided by the current @@ -212,24 +215,37 @@ class NavigationDelegate { /// iOS and Android: /// /// ```dart -/// final SslAuthRequest request = ...; +/// final SslAuthError error = ...; /// /// if (WebViewPlatform.instance is WebKitWebViewPlatform) { -/// final WebKitSslAuthRequest webKitRequest = -/// request.platform as WebKitSslAuthRequest; +/// final WebKitSslAuthError webKitError = +/// error.platform as WebKitSslAuthError; /// } else if (WebViewPlatform.instance is AndroidWebViewPlatform) { -/// final AndroidSslAuthRequest androidRequest = -/// request.platform as AndroidSslAuthRequest; +/// final AndroidSslAuthError androidError = +/// error.platform as AndroidSslAuthError; /// } /// ``` -class SslAuthRequest { - SslAuthRequest._fromPlatform(this.platform); +class SslAuthError { + SslAuthError._fromPlatform(this.platform); - final PlatformSslAuthRequest platform; + /// An implementation of [PlatformSslAuthError] for the current platform. + final PlatformSslAuthError platform; - List get certificate => platform.certificates; + /// The certificate associated with this error. + X509Certificate? get certificate => platform.certificate; + /// Instructs the WebView that encountered the SSL certificate error to + /// terminate communication with the server. + /// + /// The host application must call this method to prevent a resource from + /// loading when an SSL certificate is invalid. Future cancel() => platform.cancel(); + /// Instructs the WebView that encountered the SSL certificate error to ignore + /// the error and continue communicating with the server. + /// + /// **Warning:** When an SSL error occurs, the host application should always + /// call [cancel] rather than [proceed] because an invalid SSL certificate + /// means the connection is not secure. Future proceed() => platform.proceed(); } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart index 8e4dad010cfa..e2222a815961 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart @@ -151,6 +151,9 @@ abstract class PlatformNavigationDelegate extends PlatformInterface { /// Invoked when the web view receives a recoverable SSL error for a /// certificate. + /// + /// The host application must call either [PlatformSslAuthError.cancel] or + /// [PlatformSslAuthError.proceed]. Future setOnSSlAuthError(SslAuthErrorCallback onSslAuthError) { throw UnimplementedError( 'setOnSSlAuthError is not implemented on the current platform.', diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_error.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_error.dart index cdb99f7b6323..7bd0576a51cb 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_error.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_ssl_auth_error.dart @@ -24,9 +24,16 @@ abstract class PlatformSslAuthError { /// Instructs the WebView that encountered the SSL certificate error to ignore /// the error and continue communicating with the server. + /// + /// **Warning:** When an SSL error occurs, the host application should always + /// call [cancel] rather than [proceed] because an invalid SSL certificate + /// means the connection is not secure. Future proceed(); /// Instructs the WebView that encountered the SSL certificate error to /// terminate communication with the server. + /// + /// The host application must call this method to prevent a resource from + /// loading when an SSL certificate is invalid. Future cancel(); } 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 d9a1c0504410..5b271b490870 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 @@ -1312,29 +1312,31 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { final SecCertificate? leafCertificate = certificates.firstOrNull; - if (leafCertificate != null) { - callback( - WebKitSslAuthError( - certificate: X509Certificate( - data: await SecCertificate.copyData(leafCertificate), - ), - description: '${exception.code}: ${exception.message}', - trust: serverTrust, - host: protectionSpace.host, - port: protectionSpace.port, - onResponse: ( - UrlSessionAuthChallengeDisposition disposition, - Map? credentialMap, - ) { - responseCompleter.complete( - [disposition, credentialMap], - ); - }, - ), - ); - - return responseCompleter.future; - } + callback( + WebKitSslAuthError( + certificate: leafCertificate != null + ? X509Certificate( + data: await SecCertificate.copyData( + leafCertificate, + ), + ) + : null, + description: '${exception.code}: ${exception.message}', + trust: serverTrust, + host: protectionSpace.host, + port: protectionSpace.port, + onResponse: ( + UrlSessionAuthChallengeDisposition disposition, + Map? credentialMap, + ) { + responseCompleter.complete( + [disposition, credentialMap], + ); + }, + ), + ); + + return responseCompleter.future; } } } From 70f77e314b4171c0513480e069c44ea250b81994 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 18:40:04 -0400 Subject: [PATCH 15/34] platform intrface error --- .../test/platform_navigation_delegate_test.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_navigation_delegate_test.dart index 2d6d40e70a1d..73ee279a4a9e 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/test/platform_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/test/platform_navigation_delegate_test.dart @@ -155,6 +155,19 @@ void main() { throwsUnimplementedError, ); }); + + test( + 'Default implementation of setOnSSlAuthError should throw unimplemented error', + () { + final PlatformNavigationDelegate callbackDelegate = + ExtendsPlatformNavigationDelegate( + const PlatformNavigationDelegateCreationParams()); + + expect( + () => callbackDelegate.setOnSSlAuthError((PlatformSslAuthError eror) {}), + throwsUnimplementedError, + ); + }); } class MockWebViewPlatformWithMixin extends MockWebViewPlatform From 0a55007bc25292d0ec433816fa407db521f8a920 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 19:00:15 -0400 Subject: [PATCH 16/34] android docs --- .../lib/src/android_ssl_auth_error.dart | 12 +++++++++--- .../lib/src/android_webview_controller.dart | 2 +- .../webview_flutter_android/pubspec.yaml | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_error.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_error.dart index 185c3c5ee12e..fc335cf705b4 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_error.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_ssl_auth_error.dart @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:meta/meta.dart'; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'android_webkit.g.dart' as android; +/// Implementation of the [PlatformSslAuthError] with the Android WebView API. class AndroidSslAuthError extends PlatformSslAuthError { - AndroidSslAuthError({ + /// Creates an [AndroidSslAuthError]. + AndroidSslAuthError._({ required super.certificate, required super.description, required android.SslErrorHandler handler, @@ -18,7 +21,10 @@ class AndroidSslAuthError extends PlatformSslAuthError { /// The URL associated with the error. final String url; - static Future fromNativeSslError({ + /// Creates an [AndroidSslAuthError] from the parameters from the native + /// `WebViewClient.onReceivedSslError`. + @internal + static Future fromNativeCallback({ required android.SslError error, required android.SslErrorHandler handler, }) async { @@ -39,7 +45,7 @@ class AndroidSslAuthError extends PlatformSslAuthError { android.SslErrorType.unknown => 'The certificate has an unknown error.', }; - return AndroidSslAuthError( + return AndroidSslAuthError._( certificate: X509Certificate( data: x509Certificate != null ? await x509Certificate.getEncoded() : null, diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index df3e79c5561a..2f93158b72a1 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -1491,7 +1491,7 @@ class AndroidNavigationDelegate extends PlatformNavigationDelegate { if (callback != null) { final AndroidSslAuthError authError = - await AndroidSslAuthError.fromNativeSslError( + await AndroidSslAuthError.fromNativeCallback( error: error, handler: handler, ); diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 1ada7690874b..f7d79a0c3db6 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -20,6 +20,7 @@ flutter: dependencies: flutter: sdk: flutter + meta: ^1.10.0 webview_flutter_platform_interface: ^2.11.0 dev_dependencies: From c195d52649fefafe45766d50d55fa62cae091aa2 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 19:27:08 -0400 Subject: [PATCH 17/34] navigation delegate tests with new mocks --- .../android_navigation_delegate_test.dart | 58 + ...ndroid_navigation_delegate_test.mocks.dart | 404 ++- ...android_webview_controller_test.mocks.dart | 2200 +++++++++++------ ...oid_webview_cookie_manager_test.mocks.dart | 397 ++- ...iew_android_cookie_manager_test.mocks.dart | 57 +- .../webview_android_widget_test.mocks.dart | 807 ++++-- 6 files changed, 2869 insertions(+), 1054 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart index fef0b9f1e80e..b05d5ce1eecc 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart @@ -3,6 +3,7 @@ // found in the LICENSE file. import 'dart:async'; +import 'dart:typed_data'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; @@ -19,6 +20,10 @@ import 'android_navigation_delegate_test.mocks.dart'; @GenerateMocks([ android_webview.HttpAuthHandler, android_webview.DownloadListener, + android_webview.SslCertificate, + android_webview.SslError, + android_webview.SslErrorHandler, + android_webview.X509Certificate, ]) void main() { TestWidgetsFlutterBinding.ensureInitialized(); @@ -624,6 +629,59 @@ void main() { verify(mockAuthHandler.cancel()); }); + + test('setOnSSlAuthError', () async { + final AndroidNavigationDelegate androidNavigationDelegate = + AndroidNavigationDelegate(_buildCreationParams()); + + final Completer errorCompleter = + Completer(); + await androidNavigationDelegate.setOnSSlAuthError( + (PlatformSslAuthError error) { + errorCompleter.complete(error); + }, + ); + + final Uint8List certificateData = Uint8List(0); + const String url = 'https://google.com'; + + final MockSslError mockSslError = MockSslError(); + when(mockSslError.url).thenReturn(url); + when(mockSslError.getPrimaryError()) + .thenAnswer((_) async => android_webview.SslErrorType.dateInvalid); + final MockSslCertificate mockSslCertificate = MockSslCertificate(); + final MockX509Certificate mockX509Certificate = MockX509Certificate(); + when(mockX509Certificate.getEncoded()).thenAnswer( + (_) async => certificateData, + ); + when(mockSslCertificate.getX509Certificate()).thenAnswer( + (_) async => mockX509Certificate, + ); + when(mockSslError.certificate).thenReturn(mockSslCertificate); + + final MockSslErrorHandler mockSslErrorHandler = MockSslErrorHandler(); + + CapturingWebViewClient.lastCreatedDelegate.onReceivedSslError!( + CapturingWebViewClient(), + TestWebView(), + mockSslErrorHandler, + mockSslError, + ); + + final AndroidSslAuthError error = + await errorCompleter.future as AndroidSslAuthError; + expect(error.certificate?.data, certificateData); + expect(error.description, 'The date of the certificate is invalid.'); + expect(error.url, url); + + await error.proceed(); + verify(mockSslErrorHandler.proceed()); + + clearInteractions(mockSslErrorHandler); + + await error.cancel(); + verify(mockSslErrorHandler.cancel()); + }); }); } diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart index 7d84c4694a10..e72891b02542 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart @@ -1,11 +1,13 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_android/test/android_navigation_delegate_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; +import 'dart:typed_data' as _i5; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i4; import 'package:webview_flutter_android/src/android_webkit.g.dart' as _i2; // ignore_for_file: type=lint @@ -24,20 +26,78 @@ import 'package:webview_flutter_android/src/android_webkit.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 _FakeHttpAuthHandler_1 extends _i1.SmartFake implements _i2.HttpAuthHandler { - _FakeHttpAuthHandler_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeHttpAuthHandler_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDownloadListener_2 extends _i1.SmartFake implements _i2.DownloadListener { - _FakeDownloadListener_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeDownloadListener_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSslCertificate_3 extends _i1.SmartFake + implements _i2.SslCertificate { + _FakeSslCertificate_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSslError_4 extends _i1.SmartFake implements _i2.SslError { + _FakeSslError_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeSslErrorHandler_5 extends _i1.SmartFake + implements _i2.SslErrorHandler { + _FakeSslErrorHandler_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakeX509Certificate_6 extends _i1.SmartFake + implements _i2.X509Certificate { + _FakeX509Certificate_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [HttpAuthHandler]. @@ -59,31 +119,52 @@ class MockHttpAuthHandler extends _i1.Mock implements _i2.HttpAuthHandler { @override _i3.Future useHttpAuthUsernamePassword() => (super.noSuchMethod( - Invocation.method(#useHttpAuthUsernamePassword, []), + Invocation.method( + #useHttpAuthUsernamePassword, + [], + ), returnValue: _i3.Future.value(false), ) as _i3.Future); @override _i3.Future cancel() => (super.noSuchMethod( - Invocation.method(#cancel, []), + Invocation.method( + #cancel, + [], + ), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - _i3.Future proceed(String? username, String? password) => + _i3.Future proceed( + String? username, + String? password, + ) => (super.noSuchMethod( - Invocation.method(#proceed, [username, password]), + Invocation.method( + #proceed, + [ + username, + password, + ], + ), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.HttpAuthHandler pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeHttpAuthHandler_1( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.HttpAuthHandler); } @@ -97,25 +178,31 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { } @override - void Function(_i2.DownloadListener, String, String, String, String, int) - get onDownloadStart => (super.noSuchMethod( - Invocation.getter(#onDownloadStart), - returnValue: ( - _i2.DownloadListener pigeon_instance, - String url, - String userAgent, - String contentDisposition, - String mimetype, - int contentLength, - ) {}, - ) as void Function( - _i2.DownloadListener, - String, - String, - String, - String, - int, - )); + void Function( + _i2.DownloadListener, + String, + String, + String, + String, + int, + ) get onDownloadStart => (super.noSuchMethod( + Invocation.getter(#onDownloadStart), + returnValue: ( + _i2.DownloadListener pigeon_instance, + String url, + String userAgent, + String contentDisposition, + String mimetype, + int contentLength, + ) {}, + ) as void Function( + _i2.DownloadListener, + String, + String, + String, + String, + int, + )); @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( @@ -128,10 +215,259 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { @override _i2.DownloadListener pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeDownloadListener_2( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.DownloadListener); } + +/// A class which mocks [SslCertificate]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockSslCertificate extends _i1.Mock implements _i2.SslCertificate { + MockSslCertificate() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i3.Future<_i2.SslCertificateDName?> getIssuedBy() => (super.noSuchMethod( + Invocation.method( + #getIssuedBy, + [], + ), + returnValue: _i3.Future<_i2.SslCertificateDName?>.value(), + ) as _i3.Future<_i2.SslCertificateDName?>); + + @override + _i3.Future<_i2.SslCertificateDName?> getIssuedTo() => (super.noSuchMethod( + Invocation.method( + #getIssuedTo, + [], + ), + returnValue: _i3.Future<_i2.SslCertificateDName?>.value(), + ) as _i3.Future<_i2.SslCertificateDName?>); + + @override + _i3.Future getValidNotAfterMsSinceEpoch() => (super.noSuchMethod( + Invocation.method( + #getValidNotAfterMsSinceEpoch, + [], + ), + returnValue: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future getValidNotBeforeMsSinceEpoch() => (super.noSuchMethod( + Invocation.method( + #getValidNotBeforeMsSinceEpoch, + [], + ), + returnValue: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future<_i2.X509Certificate?> getX509Certificate() => (super.noSuchMethod( + Invocation.method( + #getX509Certificate, + [], + ), + returnValue: _i3.Future<_i2.X509Certificate?>.value(), + ) as _i3.Future<_i2.X509Certificate?>); + + @override + _i2.SslCertificate pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeSslCertificate_3( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.SslCertificate); +} + +/// A class which mocks [SslError]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockSslError extends _i1.Mock implements _i2.SslError { + MockSslError() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.SslCertificate get certificate => (super.noSuchMethod( + Invocation.getter(#certificate), + returnValue: _FakeSslCertificate_3( + this, + Invocation.getter(#certificate), + ), + ) as _i2.SslCertificate); + + @override + String get url => (super.noSuchMethod( + Invocation.getter(#url), + returnValue: _i4.dummyValue( + this, + Invocation.getter(#url), + ), + ) as String); + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i3.Future<_i2.SslErrorType> getPrimaryError() => (super.noSuchMethod( + Invocation.method( + #getPrimaryError, + [], + ), + returnValue: + _i3.Future<_i2.SslErrorType>.value(_i2.SslErrorType.dateInvalid), + ) as _i3.Future<_i2.SslErrorType>); + + @override + _i3.Future hasError(_i2.SslErrorType? error) => (super.noSuchMethod( + Invocation.method( + #hasError, + [error], + ), + returnValue: _i3.Future.value(false), + ) as _i3.Future); + + @override + _i2.SslError pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeSslError_4( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.SslError); +} + +/// A class which mocks [SslErrorHandler]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockSslErrorHandler extends _i1.Mock implements _i2.SslErrorHandler { + MockSslErrorHandler() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i3.Future cancel() => (super.noSuchMethod( + Invocation.method( + #cancel, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i3.Future proceed() => (super.noSuchMethod( + Invocation.method( + #proceed, + [], + ), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); + + @override + _i2.SslErrorHandler pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeSslErrorHandler_5( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.SslErrorHandler); +} + +/// A class which mocks [X509Certificate]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockX509Certificate extends _i1.Mock implements _i2.X509Certificate { + MockX509Certificate() { + _i1.throwOnMissingStub(this); + } + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i2.X509Certificate pigeon_copy() => (super.noSuchMethod( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeX509Certificate_6( + this, + Invocation.method( + #pigeon_copy, + [], + ), + ), + ) as _i2.X509Certificate); + + @override + _i3.Future<_i5.Uint8List> getEncoded() => (super.noSuchMethod( + Invocation.method( + #getEncoded, + [], + ), + returnValue: _i3.Future<_i5.Uint8List>.value(_i5.Uint8List(0)), + ) as _i3.Future<_i5.Uint8List>); +} diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart index 102470066572..efcb9d7d48d1 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart @@ -1,17 +1,16 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_android/test/android_webview_controller_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:typed_data' as _i13; +import 'dart:typed_data' as _i12; import 'dart:ui' as _i4; -import 'package:flutter/foundation.dart' as _i10; -import 'package:flutter/gestures.dart' as _i11; +import 'package:flutter/gestures.dart' as _i10; import 'package:flutter/services.dart' as _i6; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i12; +import 'package:mockito/src/dummies.dart' as _i11; import 'package:webview_flutter_android/src/android_proxy.dart' as _i9; import 'package:webview_flutter_android/src/android_webkit.g.dart' as _i2; import 'package:webview_flutter_android/src/android_webview_controller.dart' @@ -37,135 +36,213 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte class _FakeWebChromeClient_0 extends _i1.SmartFake implements _i2.WebChromeClient { - _FakeWebChromeClient_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebChromeClient_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWebViewClient_1 extends _i1.SmartFake implements _i2.WebViewClient { - _FakeWebViewClient_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebViewClient_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDownloadListener_2 extends _i1.SmartFake implements _i2.DownloadListener { - _FakeDownloadListener_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); -} - -class _FakePlatformNavigationDelegateCreationParams_3 extends _i1.SmartFake - implements _i3.PlatformNavigationDelegateCreationParams { - _FakePlatformNavigationDelegateCreationParams_3( + _FakeDownloadListener_2( Object parent, Invocation parentInvocation, - ) : super(parent, parentInvocation); + ) : super( + parent, + parentInvocation, + ); } -class _FakePlatformWebViewControllerCreationParams_4 extends _i1.SmartFake +class _FakePlatformWebViewControllerCreationParams_3 extends _i1.SmartFake implements _i3.PlatformWebViewControllerCreationParams { - _FakePlatformWebViewControllerCreationParams_4( + _FakePlatformWebViewControllerCreationParams_3( Object parent, Invocation parentInvocation, - ) : super(parent, parentInvocation); + ) : super( + parent, + parentInvocation, + ); } -class _FakeObject_5 extends _i1.SmartFake implements Object { - _FakeObject_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); +class _FakeObject_4 extends _i1.SmartFake implements Object { + _FakeObject_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeOffset_6 extends _i1.SmartFake implements _i4.Offset { - _FakeOffset_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); +class _FakeOffset_5 extends _i1.SmartFake implements _i4.Offset { + _FakeOffset_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeWebView_7 extends _i1.SmartFake implements _i2.WebView { - _FakeWebView_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); +class _FakeWebView_6 extends _i1.SmartFake implements _i2.WebView { + _FakeWebView_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeJavaScriptChannel_8 extends _i1.SmartFake +class _FakeJavaScriptChannel_7 extends _i1.SmartFake implements _i2.JavaScriptChannel { - _FakeJavaScriptChannel_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeJavaScriptChannel_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeCookieManager_9 extends _i1.SmartFake implements _i2.CookieManager { - _FakeCookieManager_9(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); +class _FakeCookieManager_8 extends _i1.SmartFake implements _i2.CookieManager { + _FakeCookieManager_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeFlutterAssetManager_10 extends _i1.SmartFake +class _FakeFlutterAssetManager_9 extends _i1.SmartFake implements _i2.FlutterAssetManager { - _FakeFlutterAssetManager_10(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeFlutterAssetManager_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeWebStorage_11 extends _i1.SmartFake implements _i2.WebStorage { - _FakeWebStorage_11(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); +class _FakeWebStorage_10 extends _i1.SmartFake implements _i2.WebStorage { + _FakeWebStorage_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakePigeonInstanceManager_12 extends _i1.SmartFake +class _FakePigeonInstanceManager_11 extends _i1.SmartFake implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_12(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakePigeonInstanceManager_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakePlatformViewsServiceProxy_13 extends _i1.SmartFake +class _FakePlatformViewsServiceProxy_12 extends _i1.SmartFake implements _i5.PlatformViewsServiceProxy { - _FakePlatformViewsServiceProxy_13(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); -} - -class _FakePlatformWebViewController_14 extends _i1.SmartFake - implements _i3.PlatformWebViewController { - _FakePlatformWebViewController_14(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakePlatformViewsServiceProxy_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeSize_15 extends _i1.SmartFake implements _i4.Size { - _FakeSize_15(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); +class _FakeSize_13 extends _i1.SmartFake implements _i4.Size { + _FakeSize_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeGeolocationPermissionsCallback_16 extends _i1.SmartFake +class _FakeGeolocationPermissionsCallback_14 extends _i1.SmartFake implements _i2.GeolocationPermissionsCallback { - _FakeGeolocationPermissionsCallback_16( + _FakeGeolocationPermissionsCallback_14( Object parent, Invocation parentInvocation, - ) : super(parent, parentInvocation); + ) : super( + parent, + parentInvocation, + ); } -class _FakePermissionRequest_17 extends _i1.SmartFake +class _FakePermissionRequest_15 extends _i1.SmartFake implements _i2.PermissionRequest { - _FakePermissionRequest_17(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakePermissionRequest_15( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeExpensiveAndroidViewController_18 extends _i1.SmartFake +class _FakeExpensiveAndroidViewController_16 extends _i1.SmartFake implements _i6.ExpensiveAndroidViewController { - _FakeExpensiveAndroidViewController_18( + _FakeExpensiveAndroidViewController_16( Object parent, Invocation parentInvocation, - ) : super(parent, parentInvocation); + ) : super( + parent, + parentInvocation, + ); } -class _FakeSurfaceAndroidViewController_19 extends _i1.SmartFake +class _FakeSurfaceAndroidViewController_17 extends _i1.SmartFake implements _i6.SurfaceAndroidViewController { - _FakeSurfaceAndroidViewController_19( + _FakeSurfaceAndroidViewController_17( Object parent, Invocation parentInvocation, - ) : super(parent, parentInvocation); + ) : super( + parent, + parentInvocation, + ); } -class _FakeWebSettings_20 extends _i1.SmartFake implements _i2.WebSettings { - _FakeWebSettings_20(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); +class _FakeWebSettings_18 extends _i1.SmartFake implements _i2.WebSettings { + _FakeWebSettings_18( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeWebViewPoint_21 extends _i1.SmartFake implements _i2.WebViewPoint { - _FakeWebViewPoint_21(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); +class _FakeWebViewPoint_19 extends _i1.SmartFake implements _i2.WebViewPoint { + _FakeWebViewPoint_19( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [AndroidNavigationDelegate]. @@ -212,35 +289,25 @@ class MockAndroidNavigationDelegate extends _i1.Mock ), ) as _i2.DownloadListener); - @override - _i3.PlatformNavigationDelegateCreationParams get params => - (super.noSuchMethod( - Invocation.getter(#params), - returnValue: _FakePlatformNavigationDelegateCreationParams_3( - this, - Invocation.getter(#params), - ), - returnValueForMissingStub: - _FakePlatformNavigationDelegateCreationParams_3( - this, - Invocation.getter(#params), - ), - ) as _i3.PlatformNavigationDelegateCreationParams); - @override _i8.Future setOnLoadRequest(_i7.LoadRequestCallback? onLoadRequest) => (super.noSuchMethod( - Invocation.method(#setOnLoadRequest, [onLoadRequest]), + Invocation.method( + #setOnLoadRequest, + [onLoadRequest], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnNavigationRequest( - _i3.NavigationRequestCallback? onNavigationRequest, - ) => + _i3.NavigationRequestCallback? onNavigationRequest) => (super.noSuchMethod( - Invocation.method(#setOnNavigationRequest, [onNavigationRequest]), + Invocation.method( + #setOnNavigationRequest, + [onNavigationRequest], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -248,7 +315,10 @@ class MockAndroidNavigationDelegate extends _i1.Mock @override _i8.Future setOnPageStarted(_i3.PageEventCallback? onPageStarted) => (super.noSuchMethod( - Invocation.method(#setOnPageStarted, [onPageStarted]), + Invocation.method( + #setOnPageStarted, + [onPageStarted], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -256,7 +326,10 @@ class MockAndroidNavigationDelegate extends _i1.Mock @override _i8.Future setOnPageFinished(_i3.PageEventCallback? onPageFinished) => (super.noSuchMethod( - Invocation.method(#setOnPageFinished, [onPageFinished]), + Invocation.method( + #setOnPageFinished, + [onPageFinished], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -264,7 +337,10 @@ class MockAndroidNavigationDelegate extends _i1.Mock @override _i8.Future setOnHttpError(_i3.HttpResponseErrorCallback? onHttpError) => (super.noSuchMethod( - Invocation.method(#setOnHttpError, [onHttpError]), + Invocation.method( + #setOnHttpError, + [onHttpError], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -272,17 +348,22 @@ class MockAndroidNavigationDelegate extends _i1.Mock @override _i8.Future setOnProgress(_i3.ProgressCallback? onProgress) => (super.noSuchMethod( - Invocation.method(#setOnProgress, [onProgress]), + Invocation.method( + #setOnProgress, + [onProgress], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnWebResourceError( - _i3.WebResourceErrorCallback? onWebResourceError, - ) => + _i3.WebResourceErrorCallback? onWebResourceError) => (super.noSuchMethod( - Invocation.method(#setOnWebResourceError, [onWebResourceError]), + Invocation.method( + #setOnWebResourceError, + [onWebResourceError], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -290,17 +371,34 @@ class MockAndroidNavigationDelegate extends _i1.Mock @override _i8.Future setOnUrlChange(_i3.UrlChangeCallback? onUrlChange) => (super.noSuchMethod( - Invocation.method(#setOnUrlChange, [onUrlChange]), + Invocation.method( + #setOnUrlChange, + [onUrlChange], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnHttpAuthRequest( - _i3.HttpAuthRequestCallback? onHttpAuthRequest, - ) => + _i3.HttpAuthRequestCallback? onHttpAuthRequest) => (super.noSuchMethod( - Invocation.method(#setOnHttpAuthRequest, [onHttpAuthRequest]), + Invocation.method( + #setOnHttpAuthRequest, + [onHttpAuthRequest], + ), + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); + + @override + _i8.Future setOnSSlAuthError( + _i3.SslAuthErrorCallback? onSslAuthError) => + (super.noSuchMethod( + Invocation.method( + #setOnSSlAuthError, + [onSslAuthError], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -321,12 +419,12 @@ class MockAndroidWebViewController extends _i1.Mock @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( Invocation.getter(#params), - returnValue: _FakePlatformWebViewControllerCreationParams_4( + returnValue: _FakePlatformWebViewControllerCreationParams_3( this, Invocation.getter(#params), ), returnValueForMissingStub: - _FakePlatformWebViewControllerCreationParams_4( + _FakePlatformWebViewControllerCreationParams_3( this, Invocation.getter(#params), ), @@ -334,110 +432,157 @@ class MockAndroidWebViewController extends _i1.Mock @override _i8.Future setAllowFileAccess(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowFileAccess, [allow]), + Invocation.method( + #setAllowFileAccess, + [allow], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( - Invocation.method(#loadFile, [absoluteFilePath]), + Invocation.method( + #loadFile, + [absoluteFilePath], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future loadFlutterAsset(String? key) => (super.noSuchMethod( - Invocation.method(#loadFlutterAsset, [key]), + Invocation.method( + #loadFlutterAsset, + [key], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future loadHtmlString(String? html, {String? baseUrl}) => + _i8.Future loadHtmlString( + String? html, { + String? baseUrl, + }) => (super.noSuchMethod( - Invocation.method(#loadHtmlString, [html], {#baseUrl: baseUrl}), + Invocation.method( + #loadHtmlString, + [html], + {#baseUrl: baseUrl}, + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future loadRequest(_i3.LoadRequestParams? params) => - (super.noSuchMethod( - Invocation.method(#loadRequest, [params]), + _i8.Future loadRequest(dynamic params) => (super.noSuchMethod( + Invocation.method( + #loadRequest, + [params], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future currentUrl() => (super.noSuchMethod( - Invocation.method(#currentUrl, []), + Invocation.method( + #currentUrl, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future canGoBack() => (super.noSuchMethod( - Invocation.method(#canGoBack, []), + Invocation.method( + #canGoBack, + [], + ), returnValue: _i8.Future.value(false), returnValueForMissingStub: _i8.Future.value(false), ) as _i8.Future); @override _i8.Future canGoForward() => (super.noSuchMethod( - Invocation.method(#canGoForward, []), + Invocation.method( + #canGoForward, + [], + ), returnValue: _i8.Future.value(false), returnValueForMissingStub: _i8.Future.value(false), ) as _i8.Future); @override _i8.Future goBack() => (super.noSuchMethod( - Invocation.method(#goBack, []), + Invocation.method( + #goBack, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future goForward() => (super.noSuchMethod( - Invocation.method(#goForward, []), + Invocation.method( + #goForward, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future reload() => (super.noSuchMethod( - Invocation.method(#reload, []), + Invocation.method( + #reload, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future clearCache() => (super.noSuchMethod( - Invocation.method(#clearCache, []), + Invocation.method( + #clearCache, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future clearLocalStorage() => (super.noSuchMethod( - Invocation.method(#clearLocalStorage, []), + Invocation.method( + #clearLocalStorage, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setPlatformNavigationDelegate( - _i3.PlatformNavigationDelegate? handler, - ) => + _i3.PlatformNavigationDelegate? handler) => (super.noSuchMethod( - Invocation.method(#setPlatformNavigationDelegate, [handler]), + Invocation.method( + #setPlatformNavigationDelegate, + [handler], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future runJavaScript(String? javaScript) => (super.noSuchMethod( - Invocation.method(#runJavaScript, [javaScript]), + Invocation.method( + #runJavaScript, + [javaScript], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -445,27 +590,34 @@ class MockAndroidWebViewController extends _i1.Mock @override _i8.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( - Invocation.method(#runJavaScriptReturningResult, [javaScript]), - returnValue: _i8.Future.value( - _FakeObject_5( - this, - Invocation.method(#runJavaScriptReturningResult, [javaScript]), - ), + Invocation.method( + #runJavaScriptReturningResult, + [javaScript], ), - returnValueForMissingStub: _i8.Future.value( - _FakeObject_5( - this, - Invocation.method(#runJavaScriptReturningResult, [javaScript]), + returnValue: _i8.Future.value(_FakeObject_4( + this, + Invocation.method( + #runJavaScriptReturningResult, + [javaScript], ), - ), + )), + returnValueForMissingStub: _i8.Future.value(_FakeObject_4( + this, + Invocation.method( + #runJavaScriptReturningResult, + [javaScript], + ), + )), ) as _i8.Future); @override _i8.Future addJavaScriptChannel( - _i3.JavaScriptChannelParams? javaScriptChannelParams, - ) => + _i3.JavaScriptChannelParams? javaScriptChannelParams) => (super.noSuchMethod( - Invocation.method(#addJavaScriptChannel, [javaScriptChannelParams]), + Invocation.method( + #addJavaScriptChannel, + [javaScriptChannelParams], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -473,82 +625,129 @@ class MockAndroidWebViewController extends _i1.Mock @override _i8.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( - Invocation.method(#removeJavaScriptChannel, [ - javaScriptChannelName, - ]), + Invocation.method( + #removeJavaScriptChannel, + [javaScriptChannelName], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future getTitle() => (super.noSuchMethod( - Invocation.method(#getTitle, []), + Invocation.method( + #getTitle, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future scrollTo(int? x, int? y) => (super.noSuchMethod( - Invocation.method(#scrollTo, [x, y]), + _i8.Future scrollTo( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollTo, + [ + x, + y, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future scrollBy(int? x, int? y) => (super.noSuchMethod( - Invocation.method(#scrollBy, [x, y]), + _i8.Future scrollBy( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollBy, + [ + x, + y, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( - Invocation.method(#getScrollPosition, []), - returnValue: _i8.Future<_i4.Offset>.value( - _FakeOffset_6(this, Invocation.method(#getScrollPosition, [])), - ), - returnValueForMissingStub: _i8.Future<_i4.Offset>.value( - _FakeOffset_6(this, Invocation.method(#getScrollPosition, [])), + Invocation.method( + #getScrollPosition, + [], ), + returnValue: _i8.Future<_i4.Offset>.value(_FakeOffset_5( + this, + Invocation.method( + #getScrollPosition, + [], + ), + )), + returnValueForMissingStub: _i8.Future<_i4.Offset>.value(_FakeOffset_5( + this, + Invocation.method( + #getScrollPosition, + [], + ), + )), ) as _i8.Future<_i4.Offset>); @override _i8.Future enableZoom(bool? enabled) => (super.noSuchMethod( - Invocation.method(#enableZoom, [enabled]), + Invocation.method( + #enableZoom, + [enabled], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [color]), + Invocation.method( + #setBackgroundColor, + [color], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => + _i8.Future setJavaScriptMode(dynamic javaScriptMode) => (super.noSuchMethod( - Invocation.method(#setJavaScriptMode, [javaScriptMode]), + Invocation.method( + #setJavaScriptMode, + [javaScriptMode], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setUserAgent(String? userAgent) => (super.noSuchMethod( - Invocation.method(#setUserAgent, [userAgent]), + Invocation.method( + #setUserAgent, + [userAgent], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnScrollPositionChange( - void Function(_i3.ScrollPositionChange)? onScrollPositionChange, - ) => + void Function(dynamic)? onScrollPositionChange) => (super.noSuchMethod( - Invocation.method(#setOnScrollPositionChange, [ - onScrollPositionChange, - ]), + Invocation.method( + #setOnScrollPositionChange, + [onScrollPositionChange], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -556,51 +755,66 @@ class MockAndroidWebViewController extends _i1.Mock @override _i8.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( - Invocation.method(#setMediaPlaybackRequiresUserGesture, [require]), + Invocation.method( + #setMediaPlaybackRequiresUserGesture, + [require], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setTextZoom(int? textZoom) => (super.noSuchMethod( - Invocation.method(#setTextZoom, [textZoom]), + Invocation.method( + #setTextZoom, + [textZoom], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setAllowContentAccess(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setAllowContentAccess, [enabled]), + Invocation.method( + #setAllowContentAccess, + [enabled], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setGeolocationEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setGeolocationEnabled, [enabled]), + Invocation.method( + #setGeolocationEnabled, + [enabled], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnShowFileSelector( - _i8.Future> Function(_i7.FileSelectorParams)? - onShowFileSelector, - ) => + _i8.Future> Function(_i7.FileSelectorParams)? + onShowFileSelector) => (super.noSuchMethod( - Invocation.method(#setOnShowFileSelector, [onShowFileSelector]), + Invocation.method( + #setOnShowFileSelector, + [onShowFileSelector], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnPlatformPermissionRequest( - void Function(_i3.PlatformWebViewPermissionRequest)? onPermissionRequest, - ) => + void Function(_i3.PlatformWebViewPermissionRequest)? + onPermissionRequest) => (super.noSuchMethod( - Invocation.method(#setOnPlatformPermissionRequest, [ - onPermissionRequest, - ]), + Invocation.method( + #setOnPlatformPermissionRequest, + [onPermissionRequest], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -611,10 +825,14 @@ class MockAndroidWebViewController extends _i1.Mock _i7.OnGeolocationPermissionsHidePrompt? onHidePrompt, }) => (super.noSuchMethod( - Invocation.method(#setGeolocationPermissionsPromptCallbacks, [], { - #onShowPrompt: onShowPrompt, - #onHidePrompt: onHidePrompt, - }), + Invocation.method( + #setGeolocationPermissionsPromptCallbacks, + [], + { + #onShowPrompt: onShowPrompt, + #onHidePrompt: onHidePrompt, + }, + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -625,66 +843,75 @@ class MockAndroidWebViewController extends _i1.Mock required _i7.OnHideCustomWidgetCallback? onHideCustomWidget, }) => (super.noSuchMethod( - Invocation.method(#setCustomWidgetCallbacks, [], { - #onShowCustomWidget: onShowCustomWidget, - #onHideCustomWidget: onHideCustomWidget, - }), + Invocation.method( + #setCustomWidgetCallbacks, + [], + { + #onShowCustomWidget: onShowCustomWidget, + #onHideCustomWidget: onHideCustomWidget, + }, + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnConsoleMessage( - void Function(_i3.JavaScriptConsoleMessage)? onConsoleMessage, - ) => + void Function(dynamic)? onConsoleMessage) => (super.noSuchMethod( - Invocation.method(#setOnConsoleMessage, [onConsoleMessage]), + Invocation.method( + #setOnConsoleMessage, + [onConsoleMessage], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future getUserAgent() => (super.noSuchMethod( - Invocation.method(#getUserAgent, []), + Invocation.method( + #getUserAgent, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnJavaScriptAlertDialog( - _i8.Future Function(_i3.JavaScriptAlertDialogRequest)? - onJavaScriptAlertDialog, - ) => + _i8.Future Function(_i3.JavaScriptAlertDialogRequest)? + onJavaScriptAlertDialog) => (super.noSuchMethod( - Invocation.method(#setOnJavaScriptAlertDialog, [ - onJavaScriptAlertDialog, - ]), + Invocation.method( + #setOnJavaScriptAlertDialog, + [onJavaScriptAlertDialog], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnJavaScriptConfirmDialog( - _i8.Future Function(_i3.JavaScriptConfirmDialogRequest)? - onJavaScriptConfirmDialog, - ) => + _i8.Future Function(_i3.JavaScriptConfirmDialogRequest)? + onJavaScriptConfirmDialog) => (super.noSuchMethod( - Invocation.method(#setOnJavaScriptConfirmDialog, [ - onJavaScriptConfirmDialog, - ]), + Invocation.method( + #setOnJavaScriptConfirmDialog, + [onJavaScriptConfirmDialog], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setOnJavaScriptTextInputDialog( - _i8.Future Function(_i3.JavaScriptTextInputDialogRequest)? - onJavaScriptTextInputDialog, - ) => + _i8.Future Function(_i3.JavaScriptTextInputDialogRequest)? + onJavaScriptTextInputDialog) => (super.noSuchMethod( - Invocation.method(#setOnJavaScriptTextInputDialog, [ - onJavaScriptTextInputDialog, - ]), + Invocation.method( + #setOnJavaScriptTextInputDialog, + [onJavaScriptTextInputDialog], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -692,7 +919,10 @@ class MockAndroidWebViewController extends _i1.Mock @override _i8.Future setOverScrollMode(_i3.WebViewOverScrollMode? mode) => (super.noSuchMethod( - Invocation.method(#setOverScrollMode, [mode]), + Invocation.method( + #setOverScrollMode, + [mode], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -704,67 +934,133 @@ class MockAndroidWebViewController extends _i1.Mock class MockAndroidWebViewProxy extends _i1.Mock implements _i9.AndroidWebViewProxy { @override - _i2.WebView Function({ - void Function(_i2.WebView, int, int, int, int)? onScrollChanged, - }) get newWebView => (super.noSuchMethod( + _i2.WebView Function( + {void Function( + _i2.WebView, + int, + int, + int, + int, + )? onScrollChanged}) get newWebView => (super.noSuchMethod( Invocation.getter(#newWebView), - returnValue: ({ - void Function(_i2.WebView, int, int, int, int)? onScrollChanged, - }) => - _FakeWebView_7(this, Invocation.getter(#newWebView)), - returnValueForMissingStub: ({ - void Function(_i2.WebView, int, int, int, int)? onScrollChanged, - }) => - _FakeWebView_7(this, Invocation.getter(#newWebView)), - ) as _i2.WebView Function({ - void Function(_i2.WebView, int, int, int, int)? onScrollChanged, - })); + returnValue: ( + {void Function( + _i2.WebView, + int, + int, + int, + int, + )? onScrollChanged}) => + _FakeWebView_6( + this, + Invocation.getter(#newWebView), + ), + returnValueForMissingStub: ( + {void Function( + _i2.WebView, + int, + int, + int, + int, + )? onScrollChanged}) => + _FakeWebView_6( + this, + Invocation.getter(#newWebView), + ), + ) as _i2.WebView Function( + {void Function( + _i2.WebView, + int, + int, + int, + int, + )? onScrollChanged})); @override _i2.JavaScriptChannel Function({ required String channelName, - required void Function(_i2.JavaScriptChannel, String) postMessage, + required void Function( + _i2.JavaScriptChannel, + String, + ) postMessage, }) get newJavaScriptChannel => (super.noSuchMethod( Invocation.getter(#newJavaScriptChannel), returnValue: ({ required String channelName, - required void Function(_i2.JavaScriptChannel, String) postMessage, + required void Function( + _i2.JavaScriptChannel, + String, + ) postMessage, }) => - _FakeJavaScriptChannel_8( + _FakeJavaScriptChannel_7( this, Invocation.getter(#newJavaScriptChannel), ), returnValueForMissingStub: ({ required String channelName, - required void Function(_i2.JavaScriptChannel, String) postMessage, + required void Function( + _i2.JavaScriptChannel, + String, + ) postMessage, }) => - _FakeJavaScriptChannel_8( + _FakeJavaScriptChannel_7( this, Invocation.getter(#newJavaScriptChannel), ), ) as _i2.JavaScriptChannel Function({ required String channelName, - required void Function(_i2.JavaScriptChannel, String) postMessage, + required void Function( + _i2.JavaScriptChannel, + String, + ) postMessage, })); @override _i2.WebViewClient Function({ - void Function(_i2.WebViewClient, _i2.WebView, String, bool)? - doUpdateVisitedHistory, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + bool, + )? doUpdateVisitedHistory, void Function( _i2.WebViewClient, _i2.WebView, _i2.AndroidMessage, _i2.AndroidMessage, )? onFormResubmission, - void Function(_i2.WebViewClient, _i2.WebView, String)? onLoadResource, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageCommitVisible, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageFinished, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageStarted, - void Function(_i2.WebViewClient, _i2.WebView, _i2.ClientCertRequest)? - onReceivedClientCertRequest, - void Function(_i2.WebViewClient, _i2.WebView, int, String, String)? - onReceivedError, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onLoadResource, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageCommitVisible, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageFinished, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageStarted, + void Function( + _i2.WebViewClient, + _i2.WebView, + _i2.ClientCertRequest, + )? onReceivedClientCertRequest, + void Function( + _i2.WebViewClient, + _i2.WebView, + int, + String, + String, + )? onReceivedError, void Function( _i2.WebViewClient, _i2.WebView, @@ -778,8 +1074,13 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebResourceRequest, _i2.WebResourceResponse, )? onReceivedHttpError, - void Function(_i2.WebViewClient, _i2.WebView, String, String?, String)? - onReceivedLoginRequest, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + String?, + String, + )? onReceivedLoginRequest, void Function( _i2.WebViewClient, _i2.WebView, @@ -798,27 +1099,57 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.SslErrorHandler, _i2.SslError, )? onReceivedSslError, - void Function(_i2.WebViewClient, _i2.WebView, double, double)? - onScaleChanged, - void Function(_i2.WebViewClient, _i2.WebView, _i2.WebResourceRequest)? - requestLoading, - void Function(_i2.WebViewClient, _i2.WebView, String)? urlLoading, + void Function( + _i2.WebViewClient, + _i2.WebView, + double, + double, + )? onScaleChanged, + void Function( + _i2.WebViewClient, + _i2.WebView, + _i2.WebResourceRequest, + )? requestLoading, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? urlLoading, }) get newWebViewClient => (super.noSuchMethod( Invocation.getter(#newWebViewClient), returnValue: ({ - void Function(_i2.WebViewClient, _i2.WebView, String, bool)? - doUpdateVisitedHistory, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + bool, + )? doUpdateVisitedHistory, void Function( _i2.WebViewClient, _i2.WebView, _i2.AndroidMessage, _i2.AndroidMessage, )? onFormResubmission, - void Function(_i2.WebViewClient, _i2.WebView, String)? onLoadResource, - void Function(_i2.WebViewClient, _i2.WebView, String)? - onPageCommitVisible, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageFinished, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageStarted, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onLoadResource, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageCommitVisible, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageFinished, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageStarted, void Function( _i2.WebViewClient, _i2.WebView, @@ -869,33 +1200,60 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.SslErrorHandler, _i2.SslError, )? onReceivedSslError, - void Function(_i2.WebViewClient, _i2.WebView, double, double)? - onScaleChanged, + void Function( + _i2.WebViewClient, + _i2.WebView, + double, + double, + )? onScaleChanged, void Function( _i2.WebViewClient, _i2.WebView, _i2.WebResourceRequest, )? requestLoading, - void Function(_i2.WebViewClient, _i2.WebView, String)? urlLoading, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? urlLoading, }) => _FakeWebViewClient_1( this, Invocation.getter(#newWebViewClient), ), returnValueForMissingStub: ({ - void Function(_i2.WebViewClient, _i2.WebView, String, bool)? - doUpdateVisitedHistory, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + bool, + )? doUpdateVisitedHistory, void Function( _i2.WebViewClient, _i2.WebView, _i2.AndroidMessage, _i2.AndroidMessage, )? onFormResubmission, - void Function(_i2.WebViewClient, _i2.WebView, String)? onLoadResource, - void Function(_i2.WebViewClient, _i2.WebView, String)? - onPageCommitVisible, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageFinished, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageStarted, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onLoadResource, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageCommitVisible, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageFinished, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageStarted, void Function( _i2.WebViewClient, _i2.WebView, @@ -946,40 +1304,72 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.SslErrorHandler, _i2.SslError, )? onReceivedSslError, - void Function(_i2.WebViewClient, _i2.WebView, double, double)? - onScaleChanged, + void Function( + _i2.WebViewClient, + _i2.WebView, + double, + double, + )? onScaleChanged, void Function( _i2.WebViewClient, _i2.WebView, _i2.WebResourceRequest, )? requestLoading, - void Function(_i2.WebViewClient, _i2.WebView, String)? urlLoading, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? urlLoading, }) => _FakeWebViewClient_1( this, Invocation.getter(#newWebViewClient), ), ) as _i2.WebViewClient Function({ - void Function(_i2.WebViewClient, _i2.WebView, String, bool)? - doUpdateVisitedHistory, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + bool, + )? doUpdateVisitedHistory, void Function( _i2.WebViewClient, _i2.WebView, _i2.AndroidMessage, _i2.AndroidMessage, )? onFormResubmission, - void Function(_i2.WebViewClient, _i2.WebView, String)? onLoadResource, - void Function(_i2.WebViewClient, _i2.WebView, String)? - onPageCommitVisible, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageFinished, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageStarted, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onLoadResource, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageCommitVisible, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageFinished, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageStarted, void Function( _i2.WebViewClient, _i2.WebView, _i2.ClientCertRequest, )? onReceivedClientCertRequest, - void Function(_i2.WebViewClient, _i2.WebView, int, String, String)? - onReceivedError, + void Function( + _i2.WebViewClient, + _i2.WebView, + int, + String, + String, + )? onReceivedError, void Function( _i2.WebViewClient, _i2.WebView, @@ -1018,66 +1408,70 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.SslErrorHandler, _i2.SslError, )? onReceivedSslError, - void Function(_i2.WebViewClient, _i2.WebView, double, double)? - onScaleChanged, + void Function( + _i2.WebViewClient, + _i2.WebView, + double, + double, + )? onScaleChanged, void Function( _i2.WebViewClient, _i2.WebView, _i2.WebResourceRequest, )? requestLoading, - void Function(_i2.WebViewClient, _i2.WebView, String)? urlLoading, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? urlLoading, })); @override - _i2.DownloadListener Function({ - required void Function( - _i2.DownloadListener, - String, - String, - String, - String, - int, - ) onDownloadStart, - }) get newDownloadListener => (super.noSuchMethod( + _i2.DownloadListener Function( + {required void Function( + _i2.DownloadListener, + String, + String, + String, + String, + int, + ) onDownloadStart}) get newDownloadListener => (super.noSuchMethod( Invocation.getter(#newDownloadListener), - returnValue: ({ - required void Function( - _i2.DownloadListener, - String, - String, - String, - String, - int, - ) onDownloadStart, - }) => + returnValue: ( + {required void Function( + _i2.DownloadListener, + String, + String, + String, + String, + int, + ) onDownloadStart}) => _FakeDownloadListener_2( this, Invocation.getter(#newDownloadListener), ), - returnValueForMissingStub: ({ - required void Function( + returnValueForMissingStub: ( + {required void Function( + _i2.DownloadListener, + String, + String, + String, + String, + int, + ) onDownloadStart}) => + _FakeDownloadListener_2( + this, + Invocation.getter(#newDownloadListener), + ), + ) as _i2.DownloadListener Function( + {required void Function( _i2.DownloadListener, String, String, String, String, int, - ) onDownloadStart, - }) => - _FakeDownloadListener_2( - this, - Invocation.getter(#newDownloadListener), - ), - ) as _i2.DownloadListener Function({ - required void Function( - _i2.DownloadListener, - String, - String, - String, - String, - int, - ) onDownloadStart, - })); + ) onDownloadStart})); @override _i2.WebChromeClient Function({ @@ -1092,7 +1486,10 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, _i2.FileChooserParams, ) onShowFileChooser, - void Function(_i2.WebChromeClient, _i2.ConsoleMessage)? onConsoleMessage, + void Function( + _i2.WebChromeClient, + _i2.ConsoleMessage, + )? onConsoleMessage, void Function(_i2.WebChromeClient)? onGeolocationPermissionsHidePrompt, void Function( _i2.WebChromeClient, @@ -1100,8 +1497,12 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, void Function(_i2.WebChromeClient)? onHideCustomView, - _i8.Future Function(_i2.WebChromeClient, _i2.WebView, String, String)? - onJsAlert, + _i8.Future Function( + _i2.WebChromeClient, + _i2.WebView, + String, + String, + )? onJsAlert, _i8.Future Function( _i2.WebChromeClient, _i2.WebView, @@ -1109,16 +1510,27 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onJsPrompt, - void Function(_i2.WebChromeClient, _i2.PermissionRequest)? - onPermissionRequest, - void Function(_i2.WebChromeClient, _i2.WebView, int)? onProgressChanged, - void Function(_i2.WebChromeClient, _i2.View, _i2.CustomViewCallback)? - onShowCustomView, + void Function( + _i2.WebChromeClient, + _i2.PermissionRequest, + )? onPermissionRequest, + void Function( + _i2.WebChromeClient, + _i2.WebView, + int, + )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, }) get newWebChromeClient => (super.noSuchMethod( Invocation.getter(#newWebChromeClient), returnValue: ({ - void Function(_i2.WebChromeClient, _i2.ConsoleMessage)? - onConsoleMessage, + void Function( + _i2.WebChromeClient, + _i2.ConsoleMessage, + )? onConsoleMessage, void Function(_i2.WebChromeClient)? onGeolocationPermissionsHidePrompt, void Function( @@ -1146,10 +1558,15 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onJsPrompt, - void Function(_i2.WebChromeClient, _i2.PermissionRequest)? - onPermissionRequest, - void Function(_i2.WebChromeClient, _i2.WebView, int)? - onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.PermissionRequest, + )? onPermissionRequest, + void Function( + _i2.WebChromeClient, + _i2.WebView, + int, + )? onProgressChanged, void Function( _i2.WebChromeClient, _i2.View, @@ -1166,8 +1583,10 @@ class MockAndroidWebViewProxy extends _i1.Mock Invocation.getter(#newWebChromeClient), ), returnValueForMissingStub: ({ - void Function(_i2.WebChromeClient, _i2.ConsoleMessage)? - onConsoleMessage, + void Function( + _i2.WebChromeClient, + _i2.ConsoleMessage, + )? onConsoleMessage, void Function(_i2.WebChromeClient)? onGeolocationPermissionsHidePrompt, void Function( @@ -1195,10 +1614,15 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onJsPrompt, - void Function(_i2.WebChromeClient, _i2.PermissionRequest)? - onPermissionRequest, - void Function(_i2.WebChromeClient, _i2.WebView, int)? - onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.PermissionRequest, + )? onPermissionRequest, + void Function( + _i2.WebChromeClient, + _i2.WebView, + int, + )? onProgressChanged, void Function( _i2.WebChromeClient, _i2.View, @@ -1226,8 +1650,10 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, _i2.FileChooserParams, ) onShowFileChooser, - void Function(_i2.WebChromeClient, _i2.ConsoleMessage)? - onConsoleMessage, + void Function( + _i2.WebChromeClient, + _i2.ConsoleMessage, + )? onConsoleMessage, void Function(_i2.WebChromeClient)? onGeolocationPermissionsHidePrompt, void Function( _i2.WebChromeClient, @@ -1248,9 +1674,15 @@ class MockAndroidWebViewProxy extends _i1.Mock String, String, )? onJsPrompt, - void Function(_i2.WebChromeClient, _i2.PermissionRequest)? - onPermissionRequest, - void Function(_i2.WebChromeClient, _i2.WebView, int)? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.PermissionRequest, + )? onPermissionRequest, + void Function( + _i2.WebChromeClient, + _i2.WebView, + int, + )? onProgressChanged, void Function( _i2.WebChromeClient, _i2.View, @@ -1269,11 +1701,11 @@ class MockAndroidWebViewProxy extends _i1.Mock @override _i2.CookieManager Function() get instanceCookieManager => (super.noSuchMethod( Invocation.getter(#instanceCookieManager), - returnValue: () => _FakeCookieManager_9( + returnValue: () => _FakeCookieManager_8( this, Invocation.getter(#instanceCookieManager), ), - returnValueForMissingStub: () => _FakeCookieManager_9( + returnValueForMissingStub: () => _FakeCookieManager_8( this, Invocation.getter(#instanceCookieManager), ), @@ -1283,11 +1715,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.FlutterAssetManager Function() get instanceFlutterAssetManager => (super.noSuchMethod( Invocation.getter(#instanceFlutterAssetManager), - returnValue: () => _FakeFlutterAssetManager_10( + returnValue: () => _FakeFlutterAssetManager_9( this, Invocation.getter(#instanceFlutterAssetManager), ), - returnValueForMissingStub: () => _FakeFlutterAssetManager_10( + returnValueForMissingStub: () => _FakeFlutterAssetManager_9( this, Invocation.getter(#instanceFlutterAssetManager), ), @@ -1296,11 +1728,11 @@ class MockAndroidWebViewProxy extends _i1.Mock @override _i2.WebStorage Function() get instanceWebStorage => (super.noSuchMethod( Invocation.getter(#instanceWebStorage), - returnValue: () => _FakeWebStorage_11( + returnValue: () => _FakeWebStorage_10( this, Invocation.getter(#instanceWebStorage), ), - returnValueForMissingStub: () => _FakeWebStorage_11( + returnValueForMissingStub: () => _FakeWebStorage_10( this, Invocation.getter(#instanceWebStorage), ), @@ -1316,11 +1748,11 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock @override _i2.PigeonInstanceManager get instanceManager => (super.noSuchMethod( Invocation.getter(#instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#instanceManager), ), @@ -1330,11 +1762,11 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock _i5.PlatformViewsServiceProxy get platformViewsServiceProxy => (super.noSuchMethod( Invocation.getter(#platformViewsServiceProxy), - returnValue: _FakePlatformViewsServiceProxy_13( + returnValue: _FakePlatformViewsServiceProxy_12( this, Invocation.getter(#platformViewsServiceProxy), ), - returnValueForMissingStub: _FakePlatformViewsServiceProxy_13( + returnValueForMissingStub: _FakePlatformViewsServiceProxy_12( this, Invocation.getter(#platformViewsServiceProxy), ), @@ -1346,35 +1778,6 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock returnValue: false, returnValueForMissingStub: false, ) as bool); - - @override - _i3.PlatformWebViewController get controller => (super.noSuchMethod( - Invocation.getter(#controller), - returnValue: _FakePlatformWebViewController_14( - this, - Invocation.getter(#controller), - ), - returnValueForMissingStub: _FakePlatformWebViewController_14( - this, - Invocation.getter(#controller), - ), - ) as _i3.PlatformWebViewController); - - @override - _i4.TextDirection get layoutDirection => (super.noSuchMethod( - Invocation.getter(#layoutDirection), - returnValue: _i4.TextDirection.rtl, - returnValueForMissingStub: _i4.TextDirection.rtl, - ) as _i4.TextDirection); - - @override - Set<_i10.Factory<_i11.OneSequenceGestureRecognizer>> get gestureRecognizers => - (super.noSuchMethod( - Invocation.getter(#gestureRecognizers), - returnValue: <_i10.Factory<_i11.OneSequenceGestureRecognizer>>{}, - returnValueForMissingStub: <_i10 - .Factory<_i11.OneSequenceGestureRecognizer>>{}, - ) as Set<_i10.Factory<_i11.OneSequenceGestureRecognizer>>); } /// A class which mocks [ExpensiveAndroidViewController]. @@ -1406,18 +1809,16 @@ class MockExpensiveAndroidViewController extends _i1.Mock @override _i6.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), - returnValue: (_i4.Offset position) => - _FakeOffset_6(this, Invocation.getter(#pointTransformer)), - returnValueForMissingStub: (_i4.Offset position) => - _FakeOffset_6(this, Invocation.getter(#pointTransformer)), + returnValue: (_i4.Offset position) => _FakeOffset_5( + this, + Invocation.getter(#pointTransformer), + ), + returnValueForMissingStub: (_i4.Offset position) => _FakeOffset_5( + this, + Invocation.getter(#pointTransformer), + ), ) as _i6.PointTransformer); - @override - set pointTransformer(_i6.PointTransformer? transformer) => super.noSuchMethod( - Invocation.setter(#pointTransformer, transformer), - returnValueForMissingStub: null, - ); - @override bool get isCreated => (super.noSuchMethod( Invocation.getter(#isCreated), @@ -1433,84 +1834,136 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValueForMissingStub: <_i6.PlatformViewCreatedCallback>[], ) as List<_i6.PlatformViewCreatedCallback>); + @override + set pointTransformer(_i6.PointTransformer? transformer) => super.noSuchMethod( + Invocation.setter( + #pointTransformer, + transformer, + ), + returnValueForMissingStub: null, + ); + @override _i8.Future setOffset(_i4.Offset? off) => (super.noSuchMethod( - Invocation.method(#setOffset, [off]), + Invocation.method( + #setOffset, + [off], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future create({_i4.Size? size, _i4.Offset? position}) => + _i8.Future create({ + _i4.Size? size, + _i4.Offset? position, + }) => (super.noSuchMethod( - Invocation.method(#create, [], {#size: size, #position: position}), + Invocation.method( + #create, + [], + { + #size: size, + #position: position, + }, + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future<_i4.Size> setSize(_i4.Size? size) => (super.noSuchMethod( - Invocation.method(#setSize, [size]), - returnValue: _i8.Future<_i4.Size>.value( - _FakeSize_15(this, Invocation.method(#setSize, [size])), - ), - returnValueForMissingStub: _i8.Future<_i4.Size>.value( - _FakeSize_15(this, Invocation.method(#setSize, [size])), + Invocation.method( + #setSize, + [size], ), + returnValue: _i8.Future<_i4.Size>.value(_FakeSize_13( + this, + Invocation.method( + #setSize, + [size], + ), + )), + returnValueForMissingStub: _i8.Future<_i4.Size>.value(_FakeSize_13( + this, + Invocation.method( + #setSize, + [size], + ), + )), ) as _i8.Future<_i4.Size>); @override _i8.Future sendMotionEvent(_i6.AndroidMotionEvent? event) => (super.noSuchMethod( - Invocation.method(#sendMotionEvent, [event]), + Invocation.method( + #sendMotionEvent, + [event], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override void addOnPlatformViewCreatedListener( - _i6.PlatformViewCreatedCallback? listener, - ) => + _i6.PlatformViewCreatedCallback? listener) => super.noSuchMethod( - Invocation.method(#addOnPlatformViewCreatedListener, [listener]), + Invocation.method( + #addOnPlatformViewCreatedListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeOnPlatformViewCreatedListener( - _i6.PlatformViewCreatedCallback? listener, - ) => + _i6.PlatformViewCreatedCallback? listener) => super.noSuchMethod( - Invocation.method(#removeOnPlatformViewCreatedListener, [listener]), + Invocation.method( + #removeOnPlatformViewCreatedListener, + [listener], + ), returnValueForMissingStub: null, ); @override _i8.Future setLayoutDirection(_i4.TextDirection? layoutDirection) => (super.noSuchMethod( - Invocation.method(#setLayoutDirection, [layoutDirection]), + Invocation.method( + #setLayoutDirection, + [layoutDirection], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future dispatchPointerEvent(_i11.PointerEvent? event) => + _i8.Future dispatchPointerEvent(_i10.PointerEvent? event) => (super.noSuchMethod( - Invocation.method(#dispatchPointerEvent, [event]), + Invocation.method( + #dispatchPointerEvent, + [event], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future clearFocus() => (super.noSuchMethod( - Invocation.method(#clearFocus, []), + Invocation.method( + #clearFocus, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future dispose() => (super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -1524,11 +1977,11 @@ class MockFlutterAssetManager extends _i1.Mock @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1536,41 +1989,57 @@ class MockFlutterAssetManager extends _i1.Mock @override _i8.Future> list(String? path) => (super.noSuchMethod( - Invocation.method(#list, [path]), - returnValue: _i8.Future>.value([]), - returnValueForMissingStub: _i8.Future>.value( - [], + Invocation.method( + #list, + [path], ), + returnValue: _i8.Future>.value([]), + returnValueForMissingStub: _i8.Future>.value([]), ) as _i8.Future>); @override _i8.Future getAssetFilePathByName(String? name) => (super.noSuchMethod( - Invocation.method(#getAssetFilePathByName, [name]), - returnValue: _i8.Future.value( - _i12.dummyValue( - this, - Invocation.method(#getAssetFilePathByName, [name]), - ), + Invocation.method( + #getAssetFilePathByName, + [name], ), - returnValueForMissingStub: _i8.Future.value( - _i12.dummyValue( - this, - Invocation.method(#getAssetFilePathByName, [name]), + returnValue: _i8.Future.value(_i11.dummyValue( + this, + Invocation.method( + #getAssetFilePathByName, + [name], ), - ), + )), + returnValueForMissingStub: + _i8.Future.value(_i11.dummyValue( + this, + Invocation.method( + #getAssetFilePathByName, + [name], + ), + )), ) as _i8.Future); @override _i2.FlutterAssetManager pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeFlutterAssetManager_10( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeFlutterAssetManager_9( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), - returnValueForMissingStub: _FakeFlutterAssetManager_10( + returnValueForMissingStub: _FakeFlutterAssetManager_9( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.FlutterAssetManager); } @@ -1583,34 +2052,54 @@ class MockGeolocationPermissionsCallback extends _i1.Mock @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), ) as _i2.PigeonInstanceManager); @override - _i8.Future invoke(String? origin, bool? allow, bool? retain) => + _i8.Future invoke( + String? origin, + bool? allow, + bool? retain, + ) => (super.noSuchMethod( - Invocation.method(#invoke, [origin, allow, retain]), + Invocation.method( + #invoke, + [ + origin, + allow, + retain, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i2.GeolocationPermissionsCallback pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeGeolocationPermissionsCallback_16( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeGeolocationPermissionsCallback_14( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), - returnValueForMissingStub: _FakeGeolocationPermissionsCallback_16( + returnValueForMissingStub: _FakeGeolocationPermissionsCallback_14( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.GeolocationPermissionsCallback); } @@ -1622,33 +2111,43 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { @override String get channelName => (super.noSuchMethod( Invocation.getter(#channelName), - returnValue: _i12.dummyValue( + returnValue: _i11.dummyValue( this, Invocation.getter(#channelName), ), - returnValueForMissingStub: _i12.dummyValue( + returnValueForMissingStub: _i11.dummyValue( this, Invocation.getter(#channelName), ), ) as String); @override - void Function(_i2.JavaScriptChannel, String) get postMessage => - (super.noSuchMethod( + void Function( + _i2.JavaScriptChannel, + String, + ) get postMessage => (super.noSuchMethod( Invocation.getter(#postMessage), - returnValue: (_i2.JavaScriptChannel pigeon_instance, String message) {}, - returnValueForMissingStub: - (_i2.JavaScriptChannel pigeon_instance, String message) {}, - ) as void Function(_i2.JavaScriptChannel, String)); + returnValue: ( + _i2.JavaScriptChannel pigeon_instance, + String message, + ) {}, + returnValueForMissingStub: ( + _i2.JavaScriptChannel pigeon_instance, + String message, + ) {}, + ) as void Function( + _i2.JavaScriptChannel, + String, + )); @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1656,14 +2155,23 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { @override _i2.JavaScriptChannel pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeJavaScriptChannel_8( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeJavaScriptChannel_7( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), - returnValueForMissingStub: _FakeJavaScriptChannel_8( + returnValueForMissingStub: _FakeJavaScriptChannel_7( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.JavaScriptChannel); } @@ -1682,11 +2190,11 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1694,28 +2202,43 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { @override _i8.Future grant(List? resources) => (super.noSuchMethod( - Invocation.method(#grant, [resources]), + Invocation.method( + #grant, + [resources], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future deny() => (super.noSuchMethod( - Invocation.method(#deny, []), + Invocation.method( + #deny, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i2.PermissionRequest pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakePermissionRequest_17( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakePermissionRequest_15( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), - returnValueForMissingStub: _FakePermissionRequest_17( + returnValueForMissingStub: _FakePermissionRequest_15( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.PermissionRequest); } @@ -1736,35 +2259,47 @@ class MockPlatformViewsServiceProxy extends _i1.Mock _i4.VoidCallback? onFocus, }) => (super.noSuchMethod( - Invocation.method(#initExpensiveAndroidView, [], { - #id: id, - #viewType: viewType, - #layoutDirection: layoutDirection, - #creationParams: creationParams, - #creationParamsCodec: creationParamsCodec, - #onFocus: onFocus, - }), - returnValue: _FakeExpensiveAndroidViewController_18( - this, - Invocation.method(#initExpensiveAndroidView, [], { + Invocation.method( + #initExpensiveAndroidView, + [], + { #id: id, #viewType: viewType, #layoutDirection: layoutDirection, #creationParams: creationParams, #creationParamsCodec: creationParamsCodec, #onFocus: onFocus, - }), + }, + ), + returnValue: _FakeExpensiveAndroidViewController_16( + this, + Invocation.method( + #initExpensiveAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), ), - returnValueForMissingStub: _FakeExpensiveAndroidViewController_18( - this, - Invocation.method(#initExpensiveAndroidView, [], { - #id: id, - #viewType: viewType, - #layoutDirection: layoutDirection, - #creationParams: creationParams, - #creationParamsCodec: creationParamsCodec, - #onFocus: onFocus, - }), + returnValueForMissingStub: _FakeExpensiveAndroidViewController_16( + this, + Invocation.method( + #initExpensiveAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), ), ) as _i6.ExpensiveAndroidViewController); @@ -1778,35 +2313,47 @@ class MockPlatformViewsServiceProxy extends _i1.Mock _i4.VoidCallback? onFocus, }) => (super.noSuchMethod( - Invocation.method(#initSurfaceAndroidView, [], { - #id: id, - #viewType: viewType, - #layoutDirection: layoutDirection, - #creationParams: creationParams, - #creationParamsCodec: creationParamsCodec, - #onFocus: onFocus, - }), - returnValue: _FakeSurfaceAndroidViewController_19( - this, - Invocation.method(#initSurfaceAndroidView, [], { + Invocation.method( + #initSurfaceAndroidView, + [], + { #id: id, #viewType: viewType, #layoutDirection: layoutDirection, #creationParams: creationParams, #creationParamsCodec: creationParamsCodec, #onFocus: onFocus, - }), + }, + ), + returnValue: _FakeSurfaceAndroidViewController_17( + this, + Invocation.method( + #initSurfaceAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), ), - returnValueForMissingStub: _FakeSurfaceAndroidViewController_19( - this, - Invocation.method(#initSurfaceAndroidView, [], { - #id: id, - #viewType: viewType, - #layoutDirection: layoutDirection, - #creationParams: creationParams, - #creationParamsCodec: creationParamsCodec, - #onFocus: onFocus, - }), + returnValueForMissingStub: _FakeSurfaceAndroidViewController_17( + this, + Invocation.method( + #initSurfaceAndroidView, + [], + { + #id: id, + #viewType: viewType, + #layoutDirection: layoutDirection, + #creationParams: creationParams, + #creationParamsCodec: creationParamsCodec, + #onFocus: onFocus, + }, + ), ), ) as _i6.SurfaceAndroidViewController); } @@ -1840,18 +2387,16 @@ class MockSurfaceAndroidViewController extends _i1.Mock @override _i6.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), - returnValue: (_i4.Offset position) => - _FakeOffset_6(this, Invocation.getter(#pointTransformer)), - returnValueForMissingStub: (_i4.Offset position) => - _FakeOffset_6(this, Invocation.getter(#pointTransformer)), + returnValue: (_i4.Offset position) => _FakeOffset_5( + this, + Invocation.getter(#pointTransformer), + ), + returnValueForMissingStub: (_i4.Offset position) => _FakeOffset_5( + this, + Invocation.getter(#pointTransformer), + ), ) as _i6.PointTransformer); - @override - set pointTransformer(_i6.PointTransformer? transformer) => super.noSuchMethod( - Invocation.setter(#pointTransformer, transformer), - returnValueForMissingStub: null, - ); - @override bool get isCreated => (super.noSuchMethod( Invocation.getter(#isCreated), @@ -1867,84 +2412,136 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValueForMissingStub: <_i6.PlatformViewCreatedCallback>[], ) as List<_i6.PlatformViewCreatedCallback>); + @override + set pointTransformer(_i6.PointTransformer? transformer) => super.noSuchMethod( + Invocation.setter( + #pointTransformer, + transformer, + ), + returnValueForMissingStub: null, + ); + @override _i8.Future setOffset(_i4.Offset? off) => (super.noSuchMethod( - Invocation.method(#setOffset, [off]), + Invocation.method( + #setOffset, + [off], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future create({_i4.Size? size, _i4.Offset? position}) => + _i8.Future create({ + _i4.Size? size, + _i4.Offset? position, + }) => (super.noSuchMethod( - Invocation.method(#create, [], {#size: size, #position: position}), + Invocation.method( + #create, + [], + { + #size: size, + #position: position, + }, + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future<_i4.Size> setSize(_i4.Size? size) => (super.noSuchMethod( - Invocation.method(#setSize, [size]), - returnValue: _i8.Future<_i4.Size>.value( - _FakeSize_15(this, Invocation.method(#setSize, [size])), - ), - returnValueForMissingStub: _i8.Future<_i4.Size>.value( - _FakeSize_15(this, Invocation.method(#setSize, [size])), + Invocation.method( + #setSize, + [size], ), + returnValue: _i8.Future<_i4.Size>.value(_FakeSize_13( + this, + Invocation.method( + #setSize, + [size], + ), + )), + returnValueForMissingStub: _i8.Future<_i4.Size>.value(_FakeSize_13( + this, + Invocation.method( + #setSize, + [size], + ), + )), ) as _i8.Future<_i4.Size>); @override _i8.Future sendMotionEvent(_i6.AndroidMotionEvent? event) => (super.noSuchMethod( - Invocation.method(#sendMotionEvent, [event]), + Invocation.method( + #sendMotionEvent, + [event], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override void addOnPlatformViewCreatedListener( - _i6.PlatformViewCreatedCallback? listener, - ) => + _i6.PlatformViewCreatedCallback? listener) => super.noSuchMethod( - Invocation.method(#addOnPlatformViewCreatedListener, [listener]), + Invocation.method( + #addOnPlatformViewCreatedListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeOnPlatformViewCreatedListener( - _i6.PlatformViewCreatedCallback? listener, - ) => + _i6.PlatformViewCreatedCallback? listener) => super.noSuchMethod( - Invocation.method(#removeOnPlatformViewCreatedListener, [listener]), + Invocation.method( + #removeOnPlatformViewCreatedListener, + [listener], + ), returnValueForMissingStub: null, ); @override _i8.Future setLayoutDirection(_i4.TextDirection? layoutDirection) => (super.noSuchMethod( - Invocation.method(#setLayoutDirection, [layoutDirection]), + Invocation.method( + #setLayoutDirection, + [layoutDirection], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future dispatchPointerEvent(_i11.PointerEvent? event) => + _i8.Future dispatchPointerEvent(_i10.PointerEvent? event) => (super.noSuchMethod( - Invocation.method(#dispatchPointerEvent, [event]), + Invocation.method( + #dispatchPointerEvent, + [event], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future clearFocus() => (super.noSuchMethod( - Invocation.method(#clearFocus, []), + Invocation.method( + #clearFocus, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future dispose() => (super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -1980,38 +2577,42 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { )); @override - _i8.Future Function(_i2.WebChromeClient, _i2.WebView, String, String) - get onJsConfirm => (super.noSuchMethod( - Invocation.getter(#onJsConfirm), - returnValue: ( - _i2.WebChromeClient pigeon_instance, - _i2.WebView webView, - String url, - String message, - ) => - _i8.Future.value(false), - returnValueForMissingStub: ( - _i2.WebChromeClient pigeon_instance, - _i2.WebView webView, - String url, - String message, - ) => - _i8.Future.value(false), - ) as _i8.Future Function( - _i2.WebChromeClient, - _i2.WebView, - String, - String, - )); + _i8.Future Function( + _i2.WebChromeClient, + _i2.WebView, + String, + String, + ) get onJsConfirm => (super.noSuchMethod( + Invocation.getter(#onJsConfirm), + returnValue: ( + _i2.WebChromeClient pigeon_instance, + _i2.WebView webView, + String url, + String message, + ) => + _i8.Future.value(false), + returnValueForMissingStub: ( + _i2.WebChromeClient pigeon_instance, + _i2.WebView webView, + String url, + String message, + ) => + _i8.Future.value(false), + ) as _i8.Future Function( + _i2.WebChromeClient, + _i2.WebView, + String, + String, + )); @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2020,9 +2621,10 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i8.Future setSynchronousReturnValueForOnShowFileChooser(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnShowFileChooser, [ - value, - ]), + Invocation.method( + #setSynchronousReturnValueForOnShowFileChooser, + [value], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2030,9 +2632,10 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i8.Future setSynchronousReturnValueForOnConsoleMessage(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnConsoleMessage, [ - value, - ]), + Invocation.method( + #setSynchronousReturnValueForOnConsoleMessage, + [value], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2040,7 +2643,10 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i8.Future setSynchronousReturnValueForOnJsAlert(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnJsAlert, [value]), + Invocation.method( + #setSynchronousReturnValueForOnJsAlert, + [value], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2048,9 +2654,10 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i8.Future setSynchronousReturnValueForOnJsConfirm(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnJsConfirm, [ - value, - ]), + Invocation.method( + #setSynchronousReturnValueForOnJsConfirm, + [value], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2058,21 +2665,33 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i8.Future setSynchronousReturnValueForOnJsPrompt(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnJsPrompt, [value]), + Invocation.method( + #setSynchronousReturnValueForOnJsPrompt, + [value], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i2.WebChromeClient pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWebChromeClient_0( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), returnValueForMissingStub: _FakeWebChromeClient_0( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebChromeClient); } @@ -2084,11 +2703,11 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2096,7 +2715,10 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i8.Future setDomStorageEnabled(bool? flag) => (super.noSuchMethod( - Invocation.method(#setDomStorageEnabled, [flag]), + Invocation.method( + #setDomStorageEnabled, + [flag], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2104,9 +2726,10 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i8.Future setJavaScriptCanOpenWindowsAutomatically(bool? flag) => (super.noSuchMethod( - Invocation.method(#setJavaScriptCanOpenWindowsAutomatically, [ - flag, - ]), + Invocation.method( + #setJavaScriptCanOpenWindowsAutomatically, + [flag], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2114,14 +2737,20 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i8.Future setSupportMultipleWindows(bool? support) => (super.noSuchMethod( - Invocation.method(#setSupportMultipleWindows, [support]), + Invocation.method( + #setSupportMultipleWindows, + [support], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( - Invocation.method(#setJavaScriptEnabled, [flag]), + Invocation.method( + #setJavaScriptEnabled, + [flag], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2129,7 +2758,10 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i8.Future setUserAgentString(String? userAgentString) => (super.noSuchMethod( - Invocation.method(#setUserAgentString, [userAgentString]), + Invocation.method( + #setUserAgentString, + [userAgentString], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2137,14 +2769,20 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i8.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( - Invocation.method(#setMediaPlaybackRequiresUserGesture, [require]), + Invocation.method( + #setMediaPlaybackRequiresUserGesture, + [require], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setSupportZoom(bool? support) => (super.noSuchMethod( - Invocation.method(#setSupportZoom, [support]), + Invocation.method( + #setSupportZoom, + [support], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2152,87 +2790,126 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i8.Future setLoadWithOverviewMode(bool? overview) => (super.noSuchMethod( - Invocation.method(#setLoadWithOverviewMode, [overview]), + Invocation.method( + #setLoadWithOverviewMode, + [overview], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setUseWideViewPort(bool? use) => (super.noSuchMethod( - Invocation.method(#setUseWideViewPort, [use]), + Invocation.method( + #setUseWideViewPort, + [use], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setDisplayZoomControls, [enabled]), + Invocation.method( + #setDisplayZoomControls, + [enabled], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setBuiltInZoomControls, [enabled]), + Invocation.method( + #setBuiltInZoomControls, + [enabled], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setAllowFileAccess(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setAllowFileAccess, [enabled]), + Invocation.method( + #setAllowFileAccess, + [enabled], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setAllowContentAccess(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setAllowContentAccess, [enabled]), + Invocation.method( + #setAllowContentAccess, + [enabled], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setGeolocationEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setGeolocationEnabled, [enabled]), + Invocation.method( + #setGeolocationEnabled, + [enabled], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setTextZoom(int? textZoom) => (super.noSuchMethod( - Invocation.method(#setTextZoom, [textZoom]), + Invocation.method( + #setTextZoom, + [textZoom], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future getUserAgentString() => (super.noSuchMethod( - Invocation.method(#getUserAgentString, []), - returnValue: _i8.Future.value( - _i12.dummyValue( - this, - Invocation.method(#getUserAgentString, []), - ), + Invocation.method( + #getUserAgentString, + [], ), - returnValueForMissingStub: _i8.Future.value( - _i12.dummyValue( - this, - Invocation.method(#getUserAgentString, []), + returnValue: _i8.Future.value(_i11.dummyValue( + this, + Invocation.method( + #getUserAgentString, + [], ), - ), + )), + returnValueForMissingStub: + _i8.Future.value(_i11.dummyValue( + this, + Invocation.method( + #getUserAgentString, + [], + ), + )), ) as _i8.Future); @override _i2.WebSettings pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWebSettings_20( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeWebSettings_18( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), - returnValueForMissingStub: _FakeWebSettings_20( + returnValueForMissingStub: _FakeWebSettings_18( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebSettings); } @@ -2244,11 +2921,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i2.WebSettings get settings => (super.noSuchMethod( Invocation.getter(#settings), - returnValue: _FakeWebSettings_20( + returnValue: _FakeWebSettings_18( this, Invocation.getter(#settings), ), - returnValueForMissingStub: _FakeWebSettings_20( + returnValueForMissingStub: _FakeWebSettings_18( this, Invocation.getter(#settings), ), @@ -2257,11 +2934,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2269,21 +2946,41 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i2.WebSettings pigeonVar_settings() => (super.noSuchMethod( - Invocation.method(#pigeonVar_settings, []), - returnValue: _FakeWebSettings_20( + Invocation.method( + #pigeonVar_settings, + [], + ), + returnValue: _FakeWebSettings_18( this, - Invocation.method(#pigeonVar_settings, []), + Invocation.method( + #pigeonVar_settings, + [], + ), ), - returnValueForMissingStub: _FakeWebSettings_20( + returnValueForMissingStub: _FakeWebSettings_18( this, - Invocation.method(#pigeonVar_settings, []), + Invocation.method( + #pigeonVar_settings, + [], + ), ), ) as _i2.WebSettings); @override - _i8.Future loadData(String? data, String? mimeType, String? encoding) => + _i8.Future loadData( + String? data, + String? mimeType, + String? encoding, + ) => (super.noSuchMethod( - Invocation.method(#loadData, [data, mimeType, encoding]), + Invocation.method( + #loadData, + [ + data, + mimeType, + encoding, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2297,78 +2994,120 @@ class MockWebView extends _i1.Mock implements _i2.WebView { String? historyUrl, ) => (super.noSuchMethod( - Invocation.method(#loadDataWithBaseUrl, [ - baseUrl, - data, - mimeType, - encoding, - historyUrl, - ]), + Invocation.method( + #loadDataWithBaseUrl, + [ + baseUrl, + data, + mimeType, + encoding, + historyUrl, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future loadUrl(String? url, Map? headers) => + _i8.Future loadUrl( + String? url, + Map? headers, + ) => (super.noSuchMethod( - Invocation.method(#loadUrl, [url, headers]), + Invocation.method( + #loadUrl, + [ + url, + headers, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future postUrl(String? url, _i13.Uint8List? data) => + _i8.Future postUrl( + String? url, + _i12.Uint8List? data, + ) => (super.noSuchMethod( - Invocation.method(#postUrl, [url, data]), + Invocation.method( + #postUrl, + [ + url, + data, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future getUrl() => (super.noSuchMethod( - Invocation.method(#getUrl, []), + Invocation.method( + #getUrl, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future canGoBack() => (super.noSuchMethod( - Invocation.method(#canGoBack, []), + Invocation.method( + #canGoBack, + [], + ), returnValue: _i8.Future.value(false), returnValueForMissingStub: _i8.Future.value(false), ) as _i8.Future); @override _i8.Future canGoForward() => (super.noSuchMethod( - Invocation.method(#canGoForward, []), + Invocation.method( + #canGoForward, + [], + ), returnValue: _i8.Future.value(false), returnValueForMissingStub: _i8.Future.value(false), ) as _i8.Future); @override _i8.Future goBack() => (super.noSuchMethod( - Invocation.method(#goBack, []), + Invocation.method( + #goBack, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future goForward() => (super.noSuchMethod( - Invocation.method(#goForward, []), + Invocation.method( + #goForward, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future reload() => (super.noSuchMethod( - Invocation.method(#reload, []), + Invocation.method( + #reload, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future clearCache(bool? includeDiskFiles) => (super.noSuchMethod( - Invocation.method(#clearCache, [includeDiskFiles]), + Invocation.method( + #clearCache, + [includeDiskFiles], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2376,14 +3115,20 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i8.Future evaluateJavascript(String? javascriptString) => (super.noSuchMethod( - Invocation.method(#evaluateJavascript, [javascriptString]), + Invocation.method( + #evaluateJavascript, + [javascriptString], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future getTitle() => (super.noSuchMethod( - Invocation.method(#getTitle, []), + Invocation.method( + #getTitle, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2391,7 +3136,10 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i8.Future setWebViewClient(_i2.WebViewClient? client) => (super.noSuchMethod( - Invocation.method(#setWebViewClient, [client]), + Invocation.method( + #setWebViewClient, + [client], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2399,14 +3147,20 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i8.Future addJavaScriptChannel(_i2.JavaScriptChannel? channel) => (super.noSuchMethod( - Invocation.method(#addJavaScriptChannel, [channel]), + Invocation.method( + #addJavaScriptChannel, + [channel], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future removeJavaScriptChannel(String? name) => (super.noSuchMethod( - Invocation.method(#removeJavaScriptChannel, [name]), + Invocation.method( + #removeJavaScriptChannel, + [name], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2414,7 +3168,10 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i8.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( - Invocation.method(#setDownloadListener, [listener]), + Invocation.method( + #setDownloadListener, + [listener], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2422,73 +3179,120 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i8.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( - Invocation.method(#setWebChromeClient, [client]), + Invocation.method( + #setWebChromeClient, + [client], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future setBackgroundColor(int? color) => (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [color]), + Invocation.method( + #setBackgroundColor, + [color], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future destroy() => (super.noSuchMethod( - Invocation.method(#destroy, []), + Invocation.method( + #destroy, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i2.WebView pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWebView_7( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeWebView_6( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), - returnValueForMissingStub: _FakeWebView_7( + returnValueForMissingStub: _FakeWebView_6( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebView); @override - _i8.Future scrollTo(int? x, int? y) => (super.noSuchMethod( - Invocation.method(#scrollTo, [x, y]), + _i8.Future scrollTo( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollTo, + [ + x, + y, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i8.Future scrollBy(int? x, int? y) => (super.noSuchMethod( - Invocation.method(#scrollBy, [x, y]), + _i8.Future scrollBy( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollBy, + [ + x, + y, + ], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i8.Future<_i2.WebViewPoint> getScrollPosition() => (super.noSuchMethod( - Invocation.method(#getScrollPosition, []), - returnValue: _i8.Future<_i2.WebViewPoint>.value( - _FakeWebViewPoint_21( - this, - Invocation.method(#getScrollPosition, []), - ), + Invocation.method( + #getScrollPosition, + [], ), - returnValueForMissingStub: _i8.Future<_i2.WebViewPoint>.value( - _FakeWebViewPoint_21( - this, - Invocation.method(#getScrollPosition, []), + returnValue: _i8.Future<_i2.WebViewPoint>.value(_FakeWebViewPoint_19( + this, + Invocation.method( + #getScrollPosition, + [], ), - ), + )), + returnValueForMissingStub: + _i8.Future<_i2.WebViewPoint>.value(_FakeWebViewPoint_19( + this, + Invocation.method( + #getScrollPosition, + [], + ), + )), ) as _i8.Future<_i2.WebViewPoint>); @override _i8.Future setOverScrollMode(_i2.OverScrollMode? mode) => (super.noSuchMethod( - Invocation.method(#setOverScrollMode, [mode]), + Invocation.method( + #setOverScrollMode, + [mode], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @@ -2501,11 +3305,11 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2513,8 +3317,7 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { @override _i8.Future setSynchronousReturnValueForShouldOverrideUrlLoading( - bool? value, - ) => + bool? value) => (super.noSuchMethod( Invocation.method( #setSynchronousReturnValueForShouldOverrideUrlLoading, @@ -2526,14 +3329,23 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { @override _i2.WebViewClient pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWebViewClient_1( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), returnValueForMissingStub: _FakeWebViewClient_1( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebViewClient); } @@ -2545,11 +3357,11 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_12( + returnValue: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_12( + returnValueForMissingStub: _FakePigeonInstanceManager_11( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2557,21 +3369,33 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { @override _i8.Future deleteAllData() => (super.noSuchMethod( - Invocation.method(#deleteAllData, []), + Invocation.method( + #deleteAllData, + [], + ), returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override _i2.WebStorage pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWebStorage_11( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeWebStorage_10( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), - returnValueForMissingStub: _FakeWebStorage_11( + returnValueForMissingStub: _FakeWebStorage_10( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebStorage); } diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart index b44e59a8c08d..0fd5fdc4bea7 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_android/test/android_webview_cookie_manager_test.dart. // Do not manually edit this file. @@ -29,13 +29,23 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte 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 _FakeCookieManager_1 extends _i1.SmartFake implements _i2.CookieManager { - _FakeCookieManager_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeCookieManager_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakePlatformWebViewControllerCreationParams_2 extends _i1.SmartFake @@ -43,17 +53,30 @@ class _FakePlatformWebViewControllerCreationParams_2 extends _i1.SmartFake _FakePlatformWebViewControllerCreationParams_2( Object parent, Invocation parentInvocation, - ) : super(parent, parentInvocation); + ) : super( + parent, + parentInvocation, + ); } class _FakeObject_3 extends _i1.SmartFake implements Object { - _FakeObject_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeObject_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeOffset_4 extends _i1.SmartFake implements _i4.Offset { - _FakeOffset_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeOffset_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [CookieManager]. @@ -74,15 +97,28 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { ) as _i2.PigeonInstanceManager); @override - _i5.Future setCookie(String? url, String? value) => (super.noSuchMethod( - Invocation.method(#setCookie, [url, value]), + _i5.Future setCookie( + String? url, + String? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setCookie, + [ + url, + value, + ], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future removeAllCookies() => (super.noSuchMethod( - Invocation.method(#removeAllCookies, []), + Invocation.method( + #removeAllCookies, + [], + ), returnValue: _i5.Future.value(false), ) as _i5.Future); @@ -92,17 +128,29 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { bool? accept, ) => (super.noSuchMethod( - Invocation.method(#setAcceptThirdPartyCookies, [webView, accept]), + Invocation.method( + #setAcceptThirdPartyCookies, + [ + webView, + accept, + ], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i2.CookieManager pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeCookieManager_1( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.CookieManager); } @@ -117,9 +165,10 @@ class MockAndroidWebViewController extends _i1.Mock } @override - int get webViewIdentifier => - (super.noSuchMethod(Invocation.getter(#webViewIdentifier), returnValue: 0) - as int); + int get webViewIdentifier => (super.noSuchMethod( + Invocation.getter(#webViewIdentifier), + returnValue: 0, + ) as int); @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( @@ -132,29 +181,45 @@ class MockAndroidWebViewController extends _i1.Mock @override _i5.Future setAllowFileAccess(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowFileAccess, [allow]), + Invocation.method( + #setAllowFileAccess, + [allow], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future loadFile(String? absoluteFilePath) => (super.noSuchMethod( - Invocation.method(#loadFile, [absoluteFilePath]), + Invocation.method( + #loadFile, + [absoluteFilePath], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future loadFlutterAsset(String? key) => (super.noSuchMethod( - Invocation.method(#loadFlutterAsset, [key]), + Invocation.method( + #loadFlutterAsset, + [key], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future loadHtmlString(String? html, {String? baseUrl}) => + _i5.Future loadHtmlString( + String? html, { + String? baseUrl, + }) => (super.noSuchMethod( - Invocation.method(#loadHtmlString, [html], {#baseUrl: baseUrl}), + Invocation.method( + #loadHtmlString, + [html], + {#baseUrl: baseUrl}, + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -162,77 +227,109 @@ class MockAndroidWebViewController extends _i1.Mock @override _i5.Future loadRequest(_i3.LoadRequestParams? params) => (super.noSuchMethod( - Invocation.method(#loadRequest, [params]), + Invocation.method( + #loadRequest, + [params], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future currentUrl() => (super.noSuchMethod( - Invocation.method(#currentUrl, []), + Invocation.method( + #currentUrl, + [], + ), returnValue: _i5.Future.value(), ) as _i5.Future); @override _i5.Future canGoBack() => (super.noSuchMethod( - Invocation.method(#canGoBack, []), + Invocation.method( + #canGoBack, + [], + ), returnValue: _i5.Future.value(false), ) as _i5.Future); @override _i5.Future canGoForward() => (super.noSuchMethod( - Invocation.method(#canGoForward, []), + Invocation.method( + #canGoForward, + [], + ), returnValue: _i5.Future.value(false), ) as _i5.Future); @override _i5.Future goBack() => (super.noSuchMethod( - Invocation.method(#goBack, []), + Invocation.method( + #goBack, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future goForward() => (super.noSuchMethod( - Invocation.method(#goForward, []), + Invocation.method( + #goForward, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future reload() => (super.noSuchMethod( - Invocation.method(#reload, []), + Invocation.method( + #reload, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future clearCache() => (super.noSuchMethod( - Invocation.method(#clearCache, []), + Invocation.method( + #clearCache, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future clearLocalStorage() => (super.noSuchMethod( - Invocation.method(#clearLocalStorage, []), + Invocation.method( + #clearLocalStorage, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setPlatformNavigationDelegate( - _i3.PlatformNavigationDelegate? handler, - ) => + _i3.PlatformNavigationDelegate? handler) => (super.noSuchMethod( - Invocation.method(#setPlatformNavigationDelegate, [handler]), + Invocation.method( + #setPlatformNavigationDelegate, + [handler], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future runJavaScript(String? javaScript) => (super.noSuchMethod( - Invocation.method(#runJavaScript, [javaScript]), + Invocation.method( + #runJavaScript, + [javaScript], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -240,21 +337,27 @@ class MockAndroidWebViewController extends _i1.Mock @override _i5.Future runJavaScriptReturningResult(String? javaScript) => (super.noSuchMethod( - Invocation.method(#runJavaScriptReturningResult, [javaScript]), - returnValue: _i5.Future.value( - _FakeObject_3( - this, - Invocation.method(#runJavaScriptReturningResult, [javaScript]), - ), + Invocation.method( + #runJavaScriptReturningResult, + [javaScript], ), + returnValue: _i5.Future.value(_FakeObject_3( + this, + Invocation.method( + #runJavaScriptReturningResult, + [javaScript], + ), + )), ) as _i5.Future); @override _i5.Future addJavaScriptChannel( - _i3.JavaScriptChannelParams? javaScriptChannelParams, - ) => + _i3.JavaScriptChannelParams? javaScriptChannelParams) => (super.noSuchMethod( - Invocation.method(#addJavaScriptChannel, [javaScriptChannelParams]), + Invocation.method( + #addJavaScriptChannel, + [javaScriptChannelParams], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -262,51 +365,88 @@ class MockAndroidWebViewController extends _i1.Mock @override _i5.Future removeJavaScriptChannel(String? javaScriptChannelName) => (super.noSuchMethod( - Invocation.method(#removeJavaScriptChannel, [ - javaScriptChannelName, - ]), + Invocation.method( + #removeJavaScriptChannel, + [javaScriptChannelName], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future getTitle() => (super.noSuchMethod( - Invocation.method(#getTitle, []), + Invocation.method( + #getTitle, + [], + ), returnValue: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future scrollTo(int? x, int? y) => (super.noSuchMethod( - Invocation.method(#scrollTo, [x, y]), + _i5.Future scrollTo( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollTo, + [ + x, + y, + ], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future scrollBy(int? x, int? y) => (super.noSuchMethod( - Invocation.method(#scrollBy, [x, y]), + _i5.Future scrollBy( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollBy, + [ + x, + y, + ], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future<_i4.Offset> getScrollPosition() => (super.noSuchMethod( - Invocation.method(#getScrollPosition, []), - returnValue: _i5.Future<_i4.Offset>.value( - _FakeOffset_4(this, Invocation.method(#getScrollPosition, [])), + Invocation.method( + #getScrollPosition, + [], ), + returnValue: _i5.Future<_i4.Offset>.value(_FakeOffset_4( + this, + Invocation.method( + #getScrollPosition, + [], + ), + )), ) as _i5.Future<_i4.Offset>); @override _i5.Future enableZoom(bool? enabled) => (super.noSuchMethod( - Invocation.method(#enableZoom, [enabled]), + Invocation.method( + #enableZoom, + [enabled], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setBackgroundColor(_i4.Color? color) => (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [color]), + Invocation.method( + #setBackgroundColor, + [color], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -314,26 +454,32 @@ class MockAndroidWebViewController extends _i1.Mock @override _i5.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( - Invocation.method(#setJavaScriptMode, [javaScriptMode]), + Invocation.method( + #setJavaScriptMode, + [javaScriptMode], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setUserAgent(String? userAgent) => (super.noSuchMethod( - Invocation.method(#setUserAgent, [userAgent]), + Invocation.method( + #setUserAgent, + [userAgent], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnScrollPositionChange( - void Function(_i3.ScrollPositionChange)? onScrollPositionChange, - ) => + void Function(_i3.ScrollPositionChange)? onScrollPositionChange) => (super.noSuchMethod( - Invocation.method(#setOnScrollPositionChange, [ - onScrollPositionChange, - ]), + Invocation.method( + #setOnScrollPositionChange, + [onScrollPositionChange], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -341,51 +487,66 @@ class MockAndroidWebViewController extends _i1.Mock @override _i5.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( - Invocation.method(#setMediaPlaybackRequiresUserGesture, [require]), + Invocation.method( + #setMediaPlaybackRequiresUserGesture, + [require], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setTextZoom(int? textZoom) => (super.noSuchMethod( - Invocation.method(#setTextZoom, [textZoom]), + Invocation.method( + #setTextZoom, + [textZoom], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setAllowContentAccess(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setAllowContentAccess, [enabled]), + Invocation.method( + #setAllowContentAccess, + [enabled], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setGeolocationEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setGeolocationEnabled, [enabled]), + Invocation.method( + #setGeolocationEnabled, + [enabled], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnShowFileSelector( - _i5.Future> Function(_i6.FileSelectorParams)? - onShowFileSelector, - ) => + _i5.Future> Function(_i6.FileSelectorParams)? + onShowFileSelector) => (super.noSuchMethod( - Invocation.method(#setOnShowFileSelector, [onShowFileSelector]), + Invocation.method( + #setOnShowFileSelector, + [onShowFileSelector], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnPlatformPermissionRequest( - void Function(_i3.PlatformWebViewPermissionRequest)? onPermissionRequest, - ) => + void Function(_i3.PlatformWebViewPermissionRequest)? + onPermissionRequest) => (super.noSuchMethod( - Invocation.method(#setOnPlatformPermissionRequest, [ - onPermissionRequest, - ]), + Invocation.method( + #setOnPlatformPermissionRequest, + [onPermissionRequest], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -396,10 +557,14 @@ class MockAndroidWebViewController extends _i1.Mock _i6.OnGeolocationPermissionsHidePrompt? onHidePrompt, }) => (super.noSuchMethod( - Invocation.method(#setGeolocationPermissionsPromptCallbacks, [], { - #onShowPrompt: onShowPrompt, - #onHidePrompt: onHidePrompt, - }), + Invocation.method( + #setGeolocationPermissionsPromptCallbacks, + [], + { + #onShowPrompt: onShowPrompt, + #onHidePrompt: onHidePrompt, + }, + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -410,65 +575,74 @@ class MockAndroidWebViewController extends _i1.Mock required _i6.OnHideCustomWidgetCallback? onHideCustomWidget, }) => (super.noSuchMethod( - Invocation.method(#setCustomWidgetCallbacks, [], { - #onShowCustomWidget: onShowCustomWidget, - #onHideCustomWidget: onHideCustomWidget, - }), + Invocation.method( + #setCustomWidgetCallbacks, + [], + { + #onShowCustomWidget: onShowCustomWidget, + #onHideCustomWidget: onHideCustomWidget, + }, + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnConsoleMessage( - void Function(_i3.JavaScriptConsoleMessage)? onConsoleMessage, - ) => + void Function(_i3.JavaScriptConsoleMessage)? onConsoleMessage) => (super.noSuchMethod( - Invocation.method(#setOnConsoleMessage, [onConsoleMessage]), + Invocation.method( + #setOnConsoleMessage, + [onConsoleMessage], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future getUserAgent() => (super.noSuchMethod( - Invocation.method(#getUserAgent, []), + Invocation.method( + #getUserAgent, + [], + ), returnValue: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnJavaScriptAlertDialog( - _i5.Future Function(_i3.JavaScriptAlertDialogRequest)? - onJavaScriptAlertDialog, - ) => + _i5.Future Function(_i3.JavaScriptAlertDialogRequest)? + onJavaScriptAlertDialog) => (super.noSuchMethod( - Invocation.method(#setOnJavaScriptAlertDialog, [ - onJavaScriptAlertDialog, - ]), + Invocation.method( + #setOnJavaScriptAlertDialog, + [onJavaScriptAlertDialog], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnJavaScriptConfirmDialog( - _i5.Future Function(_i3.JavaScriptConfirmDialogRequest)? - onJavaScriptConfirmDialog, - ) => + _i5.Future Function(_i3.JavaScriptConfirmDialogRequest)? + onJavaScriptConfirmDialog) => (super.noSuchMethod( - Invocation.method(#setOnJavaScriptConfirmDialog, [ - onJavaScriptConfirmDialog, - ]), + Invocation.method( + #setOnJavaScriptConfirmDialog, + [onJavaScriptConfirmDialog], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setOnJavaScriptTextInputDialog( - _i5.Future Function(_i3.JavaScriptTextInputDialogRequest)? - onJavaScriptTextInputDialog, - ) => + _i5.Future Function(_i3.JavaScriptTextInputDialogRequest)? + onJavaScriptTextInputDialog) => (super.noSuchMethod( - Invocation.method(#setOnJavaScriptTextInputDialog, [ - onJavaScriptTextInputDialog, - ]), + Invocation.method( + #setOnJavaScriptTextInputDialog, + [onJavaScriptTextInputDialog], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -476,7 +650,10 @@ class MockAndroidWebViewController extends _i1.Mock @override _i5.Future setOverScrollMode(_i3.WebViewOverScrollMode? mode) => (super.noSuchMethod( - Invocation.method(#setOverScrollMode, [mode]), + Invocation.method( + #setOverScrollMode, + [mode], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart index 68d1d82b29c6..3e523c6bf426 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_android/test/legacy/webview_android_cookie_manager_test.dart. // Do not manually edit this file. @@ -24,13 +24,23 @@ import 'package:webview_flutter_android/src/android_webkit.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 _FakeCookieManager_1 extends _i1.SmartFake implements _i2.CookieManager { - _FakeCookieManager_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeCookieManager_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [CookieManager]. @@ -51,15 +61,28 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { ) as _i2.PigeonInstanceManager); @override - _i3.Future setCookie(String? url, String? value) => (super.noSuchMethod( - Invocation.method(#setCookie, [url, value]), + _i3.Future setCookie( + String? url, + String? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setCookie, + [ + url, + value, + ], + ), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i3.Future removeAllCookies() => (super.noSuchMethod( - Invocation.method(#removeAllCookies, []), + Invocation.method( + #removeAllCookies, + [], + ), returnValue: _i3.Future.value(false), ) as _i3.Future); @@ -69,17 +92,29 @@ class MockCookieManager extends _i1.Mock implements _i2.CookieManager { bool? accept, ) => (super.noSuchMethod( - Invocation.method(#setAcceptThirdPartyCookies, [webView, accept]), + Invocation.method( + #setAcceptThirdPartyCookies, + [ + webView, + accept, + ], + ), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.CookieManager pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeCookieManager_1( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.CookieManager); } diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart index 6eebf3a56d85..374fb136d376 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_android/test/legacy/webview_android_widget_test.dart. // Do not manually edit this file. @@ -30,69 +30,129 @@ import 'package:webview_flutter_platform_interface/src/webview_flutter_platform_ 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 _FakeFlutterAssetManager_1 extends _i1.SmartFake implements _i2.FlutterAssetManager { - _FakeFlutterAssetManager_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeFlutterAssetManager_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWebSettings_2 extends _i1.SmartFake implements _i2.WebSettings { - _FakeWebSettings_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebSettings_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWebStorage_3 extends _i1.SmartFake implements _i2.WebStorage { - _FakeWebStorage_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebStorage_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWebView_4 extends _i1.SmartFake implements _i2.WebView { - _FakeWebView_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebView_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWebViewPoint_5 extends _i1.SmartFake implements _i2.WebViewPoint { - _FakeWebViewPoint_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebViewPoint_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWebResourceRequest_6 extends _i1.SmartFake implements _i2.WebResourceRequest { - _FakeWebResourceRequest_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebResourceRequest_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDownloadListener_7 extends _i1.SmartFake implements _i2.DownloadListener { - _FakeDownloadListener_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeDownloadListener_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeJavascriptChannelRegistry_8 extends _i1.SmartFake implements _i3.JavascriptChannelRegistry { - _FakeJavascriptChannelRegistry_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeJavascriptChannelRegistry_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeJavaScriptChannel_9 extends _i1.SmartFake implements _i2.JavaScriptChannel { - _FakeJavaScriptChannel_9(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeJavaScriptChannel_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWebChromeClient_10 extends _i1.SmartFake implements _i2.WebChromeClient { - _FakeWebChromeClient_10(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebChromeClient_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWebViewClient_11 extends _i1.SmartFake implements _i2.WebViewClient { - _FakeWebViewClient_11(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWebViewClient_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [FlutterAssetManager]. @@ -115,28 +175,41 @@ class MockFlutterAssetManager extends _i1.Mock @override _i4.Future> list(String? path) => (super.noSuchMethod( - Invocation.method(#list, [path]), + Invocation.method( + #list, + [path], + ), returnValue: _i4.Future>.value([]), ) as _i4.Future>); @override _i4.Future getAssetFilePathByName(String? name) => (super.noSuchMethod( - Invocation.method(#getAssetFilePathByName, [name]), - returnValue: _i4.Future.value( - _i5.dummyValue( - this, - Invocation.method(#getAssetFilePathByName, [name]), - ), + Invocation.method( + #getAssetFilePathByName, + [name], ), + returnValue: _i4.Future.value(_i5.dummyValue( + this, + Invocation.method( + #getAssetFilePathByName, + [name], + ), + )), ) as _i4.Future); @override _i2.FlutterAssetManager pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeFlutterAssetManager_1( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.FlutterAssetManager); } @@ -160,7 +233,10 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i4.Future setDomStorageEnabled(bool? flag) => (super.noSuchMethod( - Invocation.method(#setDomStorageEnabled, [flag]), + Invocation.method( + #setDomStorageEnabled, + [flag], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -168,9 +244,10 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i4.Future setJavaScriptCanOpenWindowsAutomatically(bool? flag) => (super.noSuchMethod( - Invocation.method(#setJavaScriptCanOpenWindowsAutomatically, [ - flag, - ]), + Invocation.method( + #setJavaScriptCanOpenWindowsAutomatically, + [flag], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -178,14 +255,20 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i4.Future setSupportMultipleWindows(bool? support) => (super.noSuchMethod( - Invocation.method(#setSupportMultipleWindows, [support]), + Invocation.method( + #setSupportMultipleWindows, + [support], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setJavaScriptEnabled(bool? flag) => (super.noSuchMethod( - Invocation.method(#setJavaScriptEnabled, [flag]), + Invocation.method( + #setJavaScriptEnabled, + [flag], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -193,7 +276,10 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i4.Future setUserAgentString(String? userAgentString) => (super.noSuchMethod( - Invocation.method(#setUserAgentString, [userAgentString]), + Invocation.method( + #setUserAgentString, + [userAgentString], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -201,14 +287,20 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i4.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( - Invocation.method(#setMediaPlaybackRequiresUserGesture, [require]), + Invocation.method( + #setMediaPlaybackRequiresUserGesture, + [require], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setSupportZoom(bool? support) => (super.noSuchMethod( - Invocation.method(#setSupportZoom, [support]), + Invocation.method( + #setSupportZoom, + [support], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -216,77 +308,111 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i4.Future setLoadWithOverviewMode(bool? overview) => (super.noSuchMethod( - Invocation.method(#setLoadWithOverviewMode, [overview]), + Invocation.method( + #setLoadWithOverviewMode, + [overview], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setUseWideViewPort(bool? use) => (super.noSuchMethod( - Invocation.method(#setUseWideViewPort, [use]), + Invocation.method( + #setUseWideViewPort, + [use], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setDisplayZoomControls(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setDisplayZoomControls, [enabled]), + Invocation.method( + #setDisplayZoomControls, + [enabled], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setBuiltInZoomControls(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setBuiltInZoomControls, [enabled]), + Invocation.method( + #setBuiltInZoomControls, + [enabled], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setAllowFileAccess(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setAllowFileAccess, [enabled]), + Invocation.method( + #setAllowFileAccess, + [enabled], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setAllowContentAccess(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setAllowContentAccess, [enabled]), + Invocation.method( + #setAllowContentAccess, + [enabled], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setGeolocationEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setGeolocationEnabled, [enabled]), + Invocation.method( + #setGeolocationEnabled, + [enabled], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setTextZoom(int? textZoom) => (super.noSuchMethod( - Invocation.method(#setTextZoom, [textZoom]), + Invocation.method( + #setTextZoom, + [textZoom], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future getUserAgentString() => (super.noSuchMethod( - Invocation.method(#getUserAgentString, []), - returnValue: _i4.Future.value( - _i5.dummyValue( - this, - Invocation.method(#getUserAgentString, []), - ), + Invocation.method( + #getUserAgentString, + [], ), + returnValue: _i4.Future.value(_i5.dummyValue( + this, + Invocation.method( + #getUserAgentString, + [], + ), + )), ) as _i4.Future); @override _i2.WebSettings pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWebSettings_2( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebSettings); } @@ -310,17 +436,26 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { @override _i4.Future deleteAllData() => (super.noSuchMethod( - Invocation.method(#deleteAllData, []), + Invocation.method( + #deleteAllData, + [], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i2.WebStorage pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWebStorage_3( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebStorage); } @@ -336,7 +471,10 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i2.WebSettings get settings => (super.noSuchMethod( Invocation.getter(#settings), - returnValue: _FakeWebSettings_2(this, Invocation.getter(#settings)), + returnValue: _FakeWebSettings_2( + this, + Invocation.getter(#settings), + ), ) as _i2.WebSettings); @override @@ -350,17 +488,34 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i2.WebSettings pigeonVar_settings() => (super.noSuchMethod( - Invocation.method(#pigeonVar_settings, []), + Invocation.method( + #pigeonVar_settings, + [], + ), returnValue: _FakeWebSettings_2( this, - Invocation.method(#pigeonVar_settings, []), + Invocation.method( + #pigeonVar_settings, + [], + ), ), ) as _i2.WebSettings); @override - _i4.Future loadData(String? data, String? mimeType, String? encoding) => + _i4.Future loadData( + String? data, + String? mimeType, + String? encoding, + ) => (super.noSuchMethod( - Invocation.method(#loadData, [data, mimeType, encoding]), + Invocation.method( + #loadData, + [ + data, + mimeType, + encoding, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -374,75 +529,117 @@ class MockWebView extends _i1.Mock implements _i2.WebView { String? historyUrl, ) => (super.noSuchMethod( - Invocation.method(#loadDataWithBaseUrl, [ - baseUrl, - data, - mimeType, - encoding, - historyUrl, - ]), + Invocation.method( + #loadDataWithBaseUrl, + [ + baseUrl, + data, + mimeType, + encoding, + historyUrl, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future loadUrl(String? url, Map? headers) => + _i4.Future loadUrl( + String? url, + Map? headers, + ) => (super.noSuchMethod( - Invocation.method(#loadUrl, [url, headers]), + Invocation.method( + #loadUrl, + [ + url, + headers, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future postUrl(String? url, _i6.Uint8List? data) => + _i4.Future postUrl( + String? url, + _i6.Uint8List? data, + ) => (super.noSuchMethod( - Invocation.method(#postUrl, [url, data]), + Invocation.method( + #postUrl, + [ + url, + data, + ], + ), 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 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 clearCache(bool? includeDiskFiles) => (super.noSuchMethod( - Invocation.method(#clearCache, [includeDiskFiles]), + Invocation.method( + #clearCache, + [includeDiskFiles], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -450,20 +647,29 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @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 getTitle() => (super.noSuchMethod( - Invocation.method(#getTitle, []), + Invocation.method( + #getTitle, + [], + ), returnValue: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setWebViewClient(_i2.WebViewClient? client) => (super.noSuchMethod( - Invocation.method(#setWebViewClient, [client]), + Invocation.method( + #setWebViewClient, + [client], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -471,14 +677,20 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i4.Future addJavaScriptChannel(_i2.JavaScriptChannel? channel) => (super.noSuchMethod( - Invocation.method(#addJavaScriptChannel, [channel]), + Invocation.method( + #addJavaScriptChannel, + [channel], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future removeJavaScriptChannel(String? name) => (super.noSuchMethod( - Invocation.method(#removeJavaScriptChannel, [name]), + Invocation.method( + #removeJavaScriptChannel, + [name], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -486,7 +698,10 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i4.Future setDownloadListener(_i2.DownloadListener? listener) => (super.noSuchMethod( - Invocation.method(#setDownloadListener, [listener]), + Invocation.method( + #setDownloadListener, + [listener], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -494,63 +709,105 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i4.Future setWebChromeClient(_i2.WebChromeClient? client) => (super.noSuchMethod( - Invocation.method(#setWebChromeClient, [client]), + Invocation.method( + #setWebChromeClient, + [client], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future setBackgroundColor(int? color) => (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [color]), + Invocation.method( + #setBackgroundColor, + [color], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future destroy() => (super.noSuchMethod( - Invocation.method(#destroy, []), + Invocation.method( + #destroy, + [], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i2.WebView pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWebView_4( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebView); @override - _i4.Future scrollTo(int? x, int? y) => (super.noSuchMethod( - Invocation.method(#scrollTo, [x, y]), + _i4.Future scrollTo( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollTo, + [ + x, + y, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - _i4.Future scrollBy(int? x, int? y) => (super.noSuchMethod( - Invocation.method(#scrollBy, [x, y]), + _i4.Future scrollBy( + int? x, + int? y, + ) => + (super.noSuchMethod( + Invocation.method( + #scrollBy, + [ + x, + y, + ], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i4.Future<_i2.WebViewPoint> getScrollPosition() => (super.noSuchMethod( - Invocation.method(#getScrollPosition, []), - returnValue: _i4.Future<_i2.WebViewPoint>.value( - _FakeWebViewPoint_5( - this, - Invocation.method(#getScrollPosition, []), - ), + Invocation.method( + #getScrollPosition, + [], ), + returnValue: _i4.Future<_i2.WebViewPoint>.value(_FakeWebViewPoint_5( + this, + Invocation.method( + #getScrollPosition, + [], + ), + )), ) as _i4.Future<_i2.WebViewPoint>); @override _i4.Future setOverScrollMode(_i2.OverScrollMode? mode) => (super.noSuchMethod( - Invocation.method(#setOverScrollMode, [mode]), + Invocation.method( + #setOverScrollMode, + [mode], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -568,7 +825,10 @@ class MockWebResourceRequest extends _i1.Mock @override String get url => (super.noSuchMethod( Invocation.getter(#url), - returnValue: _i5.dummyValue(this, Invocation.getter(#url)), + returnValue: _i5.dummyValue( + this, + Invocation.getter(#url), + ), ) as String); @override @@ -578,9 +838,10 @@ class MockWebResourceRequest extends _i1.Mock ) as bool); @override - bool get hasGesture => - (super.noSuchMethod(Invocation.getter(#hasGesture), returnValue: false) - as bool); + bool get hasGesture => (super.noSuchMethod( + Invocation.getter(#hasGesture), + returnValue: false, + ) as bool); @override String get method => (super.noSuchMethod( @@ -602,10 +863,16 @@ class MockWebResourceRequest extends _i1.Mock @override _i2.WebResourceRequest pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWebResourceRequest_6( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebResourceRequest); } @@ -619,25 +886,31 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { } @override - void Function(_i2.DownloadListener, String, String, String, String, int) - get onDownloadStart => (super.noSuchMethod( - Invocation.getter(#onDownloadStart), - returnValue: ( - _i2.DownloadListener pigeon_instance, - String url, - String userAgent, - String contentDisposition, - String mimetype, - int contentLength, - ) {}, - ) as void Function( - _i2.DownloadListener, - String, - String, - String, - String, - int, - )); + void Function( + _i2.DownloadListener, + String, + String, + String, + String, + int, + ) get onDownloadStart => (super.noSuchMethod( + Invocation.getter(#onDownloadStart), + returnValue: ( + _i2.DownloadListener pigeon_instance, + String url, + String userAgent, + String contentDisposition, + String mimetype, + int contentLength, + ) {}, + ) as void Function( + _i2.DownloadListener, + String, + String, + String, + String, + int, + )); @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( @@ -650,10 +923,16 @@ class MockDownloadListener extends _i1.Mock implements _i2.DownloadListener { @override _i2.DownloadListener pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeDownloadListener_7( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.DownloadListener); } @@ -687,11 +966,19 @@ class MockWebViewAndroidJavaScriptChannel extends _i1.Mock ) as String); @override - void Function(_i2.JavaScriptChannel, String) get postMessage => - (super.noSuchMethod( + void Function( + _i2.JavaScriptChannel, + String, + ) get postMessage => (super.noSuchMethod( Invocation.getter(#postMessage), - returnValue: (_i2.JavaScriptChannel pigeon_instance, String message) {}, - ) as void Function(_i2.JavaScriptChannel, String)); + returnValue: ( + _i2.JavaScriptChannel pigeon_instance, + String message, + ) {}, + ) as void Function( + _i2.JavaScriptChannel, + String, + )); @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( @@ -704,10 +991,16 @@ class MockWebViewAndroidJavaScriptChannel extends _i1.Mock @override _i2.JavaScriptChannel pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeJavaScriptChannel_9( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.JavaScriptChannel); } @@ -740,22 +1033,26 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { )); @override - _i4.Future Function(_i2.WebChromeClient, _i2.WebView, String, String) - get onJsConfirm => (super.noSuchMethod( - Invocation.getter(#onJsConfirm), - returnValue: ( - _i2.WebChromeClient pigeon_instance, - _i2.WebView webView, - String url, - String message, - ) => - _i4.Future.value(false), - ) as _i4.Future Function( - _i2.WebChromeClient, - _i2.WebView, - String, - String, - )); + _i4.Future Function( + _i2.WebChromeClient, + _i2.WebView, + String, + String, + ) get onJsConfirm => (super.noSuchMethod( + Invocation.getter(#onJsConfirm), + returnValue: ( + _i2.WebChromeClient pigeon_instance, + _i2.WebView webView, + String url, + String message, + ) => + _i4.Future.value(false), + ) as _i4.Future Function( + _i2.WebChromeClient, + _i2.WebView, + String, + String, + )); @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( @@ -769,9 +1066,10 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i4.Future setSynchronousReturnValueForOnShowFileChooser(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnShowFileChooser, [ - value, - ]), + Invocation.method( + #setSynchronousReturnValueForOnShowFileChooser, + [value], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -779,9 +1077,10 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i4.Future setSynchronousReturnValueForOnConsoleMessage(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnConsoleMessage, [ - value, - ]), + Invocation.method( + #setSynchronousReturnValueForOnConsoleMessage, + [value], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -789,7 +1088,10 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i4.Future setSynchronousReturnValueForOnJsAlert(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnJsAlert, [value]), + Invocation.method( + #setSynchronousReturnValueForOnJsAlert, + [value], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -797,9 +1099,10 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i4.Future setSynchronousReturnValueForOnJsConfirm(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnJsConfirm, [ - value, - ]), + Invocation.method( + #setSynchronousReturnValueForOnJsConfirm, + [value], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -807,17 +1110,26 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i4.Future setSynchronousReturnValueForOnJsPrompt(bool? value) => (super.noSuchMethod( - Invocation.method(#setSynchronousReturnValueForOnJsPrompt, [value]), + Invocation.method( + #setSynchronousReturnValueForOnJsPrompt, + [value], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override _i2.WebChromeClient pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWebChromeClient_10( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebChromeClient); } @@ -841,8 +1153,7 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { @override _i4.Future setSynchronousReturnValueForShouldOverrideUrlLoading( - bool? value, - ) => + bool? value) => (super.noSuchMethod( Invocation.method( #setSynchronousReturnValueForShouldOverrideUrlLoading, @@ -854,10 +1165,16 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { @override _i2.WebViewClient pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWebViewClient_11( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WebViewClient); } @@ -878,16 +1195,28 @@ 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<_i3.JavascriptChannel>? channels) => super.noSuchMethod( - Invocation.method(#updateJavascriptChannelsFromSet, [channels]), + Invocation.method( + #updateJavascriptChannelsFromSet, + [channels], + ), returnValueForMissingStub: null, ); } @@ -907,34 +1236,50 @@ 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(_i3.WebResourceError? error) => super.noSuchMethod( - Invocation.method(#onWebResourceError, [error]), + Invocation.method( + #onWebResourceError, + [error], + ), returnValueForMissingStub: null, ); } @@ -949,58 +1294,77 @@ class MockWebViewProxy extends _i1.Mock implements _i7.WebViewProxy { @override _i2.WebView createWebView() => (super.noSuchMethod( - Invocation.method(#createWebView, []), + Invocation.method( + #createWebView, + [], + ), returnValue: _FakeWebView_4( this, - Invocation.method(#createWebView, []), + Invocation.method( + #createWebView, + [], + ), ), ) as _i2.WebView); @override _i2.WebViewClient createWebViewClient({ - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageStarted, - void Function(_i2.WebViewClient, _i2.WebView, String)? onPageFinished, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageStarted, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? onPageFinished, void Function( _i2.WebViewClient, _i2.WebView, _i2.WebResourceRequest, _i2.WebResourceError, )? onReceivedRequestError, - void Function(_i2.WebViewClient, _i2.WebView, int, String, String)? - onReceivedError, - void Function(_i2.WebViewClient, _i2.WebView, _i2.WebResourceRequest)? - requestLoading, + void Function( + _i2.WebViewClient, + _i2.WebView, + int, + String, + String, + )? onReceivedError, + void Function( + _i2.WebViewClient, + _i2.WebView, + _i2.WebResourceRequest, + )? requestLoading, void Function( _i2.WebViewClient, _i2.WebView, _i2.AndroidMessage, _i2.AndroidMessage, )? onFormResubmission, - void Function(_i2.WebViewClient, _i2.WebView, _i2.ClientCertRequest)? - onReceivedClientCertRequest, + void Function( + _i2.WebViewClient, + _i2.WebView, + _i2.ClientCertRequest, + )? onReceivedClientCertRequest, void Function( _i2.WebViewClient, _i2.WebView, _i2.SslErrorHandler, _i2.SslError, )? onReceivedSslError, - void Function(_i2.WebViewClient, _i2.WebView, String)? urlLoading, + void Function( + _i2.WebViewClient, + _i2.WebView, + String, + )? urlLoading, }) => (super.noSuchMethod( - Invocation.method(#createWebViewClient, [], { - #onPageStarted: onPageStarted, - #onPageFinished: onPageFinished, - #onReceivedRequestError: onReceivedRequestError, - #onReceivedError: onReceivedError, - #requestLoading: requestLoading, - #onFormResubmission: onFormResubmission, - #onReceivedClientCertRequest: onReceivedClientCertRequest, - #onReceivedSslError: onReceivedSslError, - #urlLoading: urlLoading, - }), - returnValue: _FakeWebViewClient_11( - this, - Invocation.method(#createWebViewClient, [], { + Invocation.method( + #createWebViewClient, + [], + { #onPageStarted: onPageStarted, #onPageFinished: onPageFinished, #onReceivedRequestError: onReceivedRequestError, @@ -1010,14 +1374,35 @@ class MockWebViewProxy extends _i1.Mock implements _i7.WebViewProxy { #onReceivedClientCertRequest: onReceivedClientCertRequest, #onReceivedSslError: onReceivedSslError, #urlLoading: urlLoading, - }), + }, + ), + returnValue: _FakeWebViewClient_11( + this, + Invocation.method( + #createWebViewClient, + [], + { + #onPageStarted: onPageStarted, + #onPageFinished: onPageFinished, + #onReceivedRequestError: onReceivedRequestError, + #onReceivedError: onReceivedError, + #requestLoading: requestLoading, + #onFormResubmission: onFormResubmission, + #onReceivedClientCertRequest: onReceivedClientCertRequest, + #onReceivedSslError: onReceivedSslError, + #urlLoading: urlLoading, + }, + ), ), ) as _i2.WebViewClient); @override _i4.Future setWebContentsDebuggingEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setWebContentsDebuggingEnabled, [enabled]), + Invocation.method( + #setWebContentsDebuggingEnabled, + [enabled], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); From ea1c23f6c83be5759bbdb0ff2d4867726df26fef Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 19:32:25 -0400 Subject: [PATCH 18/34] fix test mocks i guess --- ...android_webview_controller_test.mocks.dart | 308 +++++++++++------- 1 file changed, 188 insertions(+), 120 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart index efcb9d7d48d1..e9a213740eff 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart @@ -4,13 +4,14 @@ // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:typed_data' as _i12; +import 'dart:typed_data' as _i13; import 'dart:ui' as _i4; -import 'package:flutter/gestures.dart' as _i10; +import 'package:flutter/foundation.dart' as _i10; +import 'package:flutter/gestures.dart' as _i11; import 'package:flutter/services.dart' as _i6; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i11; +import 'package:mockito/src/dummies.dart' as _i12; import 'package:webview_flutter_android/src/android_proxy.dart' as _i9; import 'package:webview_flutter_android/src/android_webkit.g.dart' as _i2; import 'package:webview_flutter_android/src/android_webview_controller.dart' @@ -66,9 +67,20 @@ class _FakeDownloadListener_2 extends _i1.SmartFake ); } -class _FakePlatformWebViewControllerCreationParams_3 extends _i1.SmartFake +class _FakePlatformNavigationDelegateCreationParams_3 extends _i1.SmartFake + implements _i3.PlatformNavigationDelegateCreationParams { + _FakePlatformNavigationDelegateCreationParams_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePlatformWebViewControllerCreationParams_4 extends _i1.SmartFake implements _i3.PlatformWebViewControllerCreationParams { - _FakePlatformWebViewControllerCreationParams_3( + _FakePlatformWebViewControllerCreationParams_4( Object parent, Invocation parentInvocation, ) : super( @@ -77,8 +89,8 @@ class _FakePlatformWebViewControllerCreationParams_3 extends _i1.SmartFake ); } -class _FakeObject_4 extends _i1.SmartFake implements Object { - _FakeObject_4( +class _FakeObject_5 extends _i1.SmartFake implements Object { + _FakeObject_5( Object parent, Invocation parentInvocation, ) : super( @@ -87,8 +99,8 @@ class _FakeObject_4 extends _i1.SmartFake implements Object { ); } -class _FakeOffset_5 extends _i1.SmartFake implements _i4.Offset { - _FakeOffset_5( +class _FakeOffset_6 extends _i1.SmartFake implements _i4.Offset { + _FakeOffset_6( Object parent, Invocation parentInvocation, ) : super( @@ -97,8 +109,8 @@ class _FakeOffset_5 extends _i1.SmartFake implements _i4.Offset { ); } -class _FakeWebView_6 extends _i1.SmartFake implements _i2.WebView { - _FakeWebView_6( +class _FakeWebView_7 extends _i1.SmartFake implements _i2.WebView { + _FakeWebView_7( Object parent, Invocation parentInvocation, ) : super( @@ -107,9 +119,9 @@ class _FakeWebView_6 extends _i1.SmartFake implements _i2.WebView { ); } -class _FakeJavaScriptChannel_7 extends _i1.SmartFake +class _FakeJavaScriptChannel_8 extends _i1.SmartFake implements _i2.JavaScriptChannel { - _FakeJavaScriptChannel_7( + _FakeJavaScriptChannel_8( Object parent, Invocation parentInvocation, ) : super( @@ -118,8 +130,8 @@ class _FakeJavaScriptChannel_7 extends _i1.SmartFake ); } -class _FakeCookieManager_8 extends _i1.SmartFake implements _i2.CookieManager { - _FakeCookieManager_8( +class _FakeCookieManager_9 extends _i1.SmartFake implements _i2.CookieManager { + _FakeCookieManager_9( Object parent, Invocation parentInvocation, ) : super( @@ -128,9 +140,9 @@ class _FakeCookieManager_8 extends _i1.SmartFake implements _i2.CookieManager { ); } -class _FakeFlutterAssetManager_9 extends _i1.SmartFake +class _FakeFlutterAssetManager_10 extends _i1.SmartFake implements _i2.FlutterAssetManager { - _FakeFlutterAssetManager_9( + _FakeFlutterAssetManager_10( Object parent, Invocation parentInvocation, ) : super( @@ -139,8 +151,8 @@ class _FakeFlutterAssetManager_9 extends _i1.SmartFake ); } -class _FakeWebStorage_10 extends _i1.SmartFake implements _i2.WebStorage { - _FakeWebStorage_10( +class _FakeWebStorage_11 extends _i1.SmartFake implements _i2.WebStorage { + _FakeWebStorage_11( Object parent, Invocation parentInvocation, ) : super( @@ -149,9 +161,9 @@ class _FakeWebStorage_10 extends _i1.SmartFake implements _i2.WebStorage { ); } -class _FakePigeonInstanceManager_11 extends _i1.SmartFake +class _FakePigeonInstanceManager_12 extends _i1.SmartFake implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_11( + _FakePigeonInstanceManager_12( Object parent, Invocation parentInvocation, ) : super( @@ -160,9 +172,20 @@ class _FakePigeonInstanceManager_11 extends _i1.SmartFake ); } -class _FakePlatformViewsServiceProxy_12 extends _i1.SmartFake +class _FakePlatformViewsServiceProxy_13 extends _i1.SmartFake implements _i5.PlatformViewsServiceProxy { - _FakePlatformViewsServiceProxy_12( + _FakePlatformViewsServiceProxy_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +class _FakePlatformWebViewController_14 extends _i1.SmartFake + implements _i3.PlatformWebViewController { + _FakePlatformWebViewController_14( Object parent, Invocation parentInvocation, ) : super( @@ -171,8 +194,8 @@ class _FakePlatformViewsServiceProxy_12 extends _i1.SmartFake ); } -class _FakeSize_13 extends _i1.SmartFake implements _i4.Size { - _FakeSize_13( +class _FakeSize_15 extends _i1.SmartFake implements _i4.Size { + _FakeSize_15( Object parent, Invocation parentInvocation, ) : super( @@ -181,9 +204,9 @@ class _FakeSize_13 extends _i1.SmartFake implements _i4.Size { ); } -class _FakeGeolocationPermissionsCallback_14 extends _i1.SmartFake +class _FakeGeolocationPermissionsCallback_16 extends _i1.SmartFake implements _i2.GeolocationPermissionsCallback { - _FakeGeolocationPermissionsCallback_14( + _FakeGeolocationPermissionsCallback_16( Object parent, Invocation parentInvocation, ) : super( @@ -192,9 +215,9 @@ class _FakeGeolocationPermissionsCallback_14 extends _i1.SmartFake ); } -class _FakePermissionRequest_15 extends _i1.SmartFake +class _FakePermissionRequest_17 extends _i1.SmartFake implements _i2.PermissionRequest { - _FakePermissionRequest_15( + _FakePermissionRequest_17( Object parent, Invocation parentInvocation, ) : super( @@ -203,9 +226,9 @@ class _FakePermissionRequest_15 extends _i1.SmartFake ); } -class _FakeExpensiveAndroidViewController_16 extends _i1.SmartFake +class _FakeExpensiveAndroidViewController_18 extends _i1.SmartFake implements _i6.ExpensiveAndroidViewController { - _FakeExpensiveAndroidViewController_16( + _FakeExpensiveAndroidViewController_18( Object parent, Invocation parentInvocation, ) : super( @@ -214,9 +237,9 @@ class _FakeExpensiveAndroidViewController_16 extends _i1.SmartFake ); } -class _FakeSurfaceAndroidViewController_17 extends _i1.SmartFake +class _FakeSurfaceAndroidViewController_19 extends _i1.SmartFake implements _i6.SurfaceAndroidViewController { - _FakeSurfaceAndroidViewController_17( + _FakeSurfaceAndroidViewController_19( Object parent, Invocation parentInvocation, ) : super( @@ -225,8 +248,8 @@ class _FakeSurfaceAndroidViewController_17 extends _i1.SmartFake ); } -class _FakeWebSettings_18 extends _i1.SmartFake implements _i2.WebSettings { - _FakeWebSettings_18( +class _FakeWebSettings_20 extends _i1.SmartFake implements _i2.WebSettings { + _FakeWebSettings_20( Object parent, Invocation parentInvocation, ) : super( @@ -235,8 +258,8 @@ class _FakeWebSettings_18 extends _i1.SmartFake implements _i2.WebSettings { ); } -class _FakeWebViewPoint_19 extends _i1.SmartFake implements _i2.WebViewPoint { - _FakeWebViewPoint_19( +class _FakeWebViewPoint_21 extends _i1.SmartFake implements _i2.WebViewPoint { + _FakeWebViewPoint_21( Object parent, Invocation parentInvocation, ) : super( @@ -289,6 +312,21 @@ class MockAndroidNavigationDelegate extends _i1.Mock ), ) as _i2.DownloadListener); + @override + _i3.PlatformNavigationDelegateCreationParams get params => + (super.noSuchMethod( + Invocation.getter(#params), + returnValue: _FakePlatformNavigationDelegateCreationParams_3( + this, + Invocation.getter(#params), + ), + returnValueForMissingStub: + _FakePlatformNavigationDelegateCreationParams_3( + this, + Invocation.getter(#params), + ), + ) as _i3.PlatformNavigationDelegateCreationParams); + @override _i8.Future setOnLoadRequest(_i7.LoadRequestCallback? onLoadRequest) => (super.noSuchMethod( @@ -419,12 +457,12 @@ class MockAndroidWebViewController extends _i1.Mock @override _i3.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod( Invocation.getter(#params), - returnValue: _FakePlatformWebViewControllerCreationParams_3( + returnValue: _FakePlatformWebViewControllerCreationParams_4( this, Invocation.getter(#params), ), returnValueForMissingStub: - _FakePlatformWebViewControllerCreationParams_3( + _FakePlatformWebViewControllerCreationParams_4( this, Invocation.getter(#params), ), @@ -476,7 +514,8 @@ class MockAndroidWebViewController extends _i1.Mock ) as _i8.Future); @override - _i8.Future loadRequest(dynamic params) => (super.noSuchMethod( + _i8.Future loadRequest(_i3.LoadRequestParams? params) => + (super.noSuchMethod( Invocation.method( #loadRequest, [params], @@ -594,14 +633,14 @@ class MockAndroidWebViewController extends _i1.Mock #runJavaScriptReturningResult, [javaScript], ), - returnValue: _i8.Future.value(_FakeObject_4( + returnValue: _i8.Future.value(_FakeObject_5( this, Invocation.method( #runJavaScriptReturningResult, [javaScript], ), )), - returnValueForMissingStub: _i8.Future.value(_FakeObject_4( + returnValueForMissingStub: _i8.Future.value(_FakeObject_5( this, Invocation.method( #runJavaScriptReturningResult, @@ -683,14 +722,14 @@ class MockAndroidWebViewController extends _i1.Mock #getScrollPosition, [], ), - returnValue: _i8.Future<_i4.Offset>.value(_FakeOffset_5( + returnValue: _i8.Future<_i4.Offset>.value(_FakeOffset_6( this, Invocation.method( #getScrollPosition, [], ), )), - returnValueForMissingStub: _i8.Future<_i4.Offset>.value(_FakeOffset_5( + returnValueForMissingStub: _i8.Future<_i4.Offset>.value(_FakeOffset_6( this, Invocation.method( #getScrollPosition, @@ -720,7 +759,7 @@ class MockAndroidWebViewController extends _i1.Mock ) as _i8.Future); @override - _i8.Future setJavaScriptMode(dynamic javaScriptMode) => + _i8.Future setJavaScriptMode(_i3.JavaScriptMode? javaScriptMode) => (super.noSuchMethod( Invocation.method( #setJavaScriptMode, @@ -742,7 +781,7 @@ class MockAndroidWebViewController extends _i1.Mock @override _i8.Future setOnScrollPositionChange( - void Function(dynamic)? onScrollPositionChange) => + void Function(_i3.ScrollPositionChange)? onScrollPositionChange) => (super.noSuchMethod( Invocation.method( #setOnScrollPositionChange, @@ -857,7 +896,7 @@ class MockAndroidWebViewController extends _i1.Mock @override _i8.Future setOnConsoleMessage( - void Function(dynamic)? onConsoleMessage) => + void Function(_i3.JavaScriptConsoleMessage)? onConsoleMessage) => (super.noSuchMethod( Invocation.method( #setOnConsoleMessage, @@ -951,7 +990,7 @@ class MockAndroidWebViewProxy extends _i1.Mock int, int, )? onScrollChanged}) => - _FakeWebView_6( + _FakeWebView_7( this, Invocation.getter(#newWebView), ), @@ -963,7 +1002,7 @@ class MockAndroidWebViewProxy extends _i1.Mock int, int, )? onScrollChanged}) => - _FakeWebView_6( + _FakeWebView_7( this, Invocation.getter(#newWebView), ), @@ -992,7 +1031,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, ) postMessage, }) => - _FakeJavaScriptChannel_7( + _FakeJavaScriptChannel_8( this, Invocation.getter(#newJavaScriptChannel), ), @@ -1003,7 +1042,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, ) postMessage, }) => - _FakeJavaScriptChannel_7( + _FakeJavaScriptChannel_8( this, Invocation.getter(#newJavaScriptChannel), ), @@ -1701,11 +1740,11 @@ class MockAndroidWebViewProxy extends _i1.Mock @override _i2.CookieManager Function() get instanceCookieManager => (super.noSuchMethod( Invocation.getter(#instanceCookieManager), - returnValue: () => _FakeCookieManager_8( + returnValue: () => _FakeCookieManager_9( this, Invocation.getter(#instanceCookieManager), ), - returnValueForMissingStub: () => _FakeCookieManager_8( + returnValueForMissingStub: () => _FakeCookieManager_9( this, Invocation.getter(#instanceCookieManager), ), @@ -1715,11 +1754,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.FlutterAssetManager Function() get instanceFlutterAssetManager => (super.noSuchMethod( Invocation.getter(#instanceFlutterAssetManager), - returnValue: () => _FakeFlutterAssetManager_9( + returnValue: () => _FakeFlutterAssetManager_10( this, Invocation.getter(#instanceFlutterAssetManager), ), - returnValueForMissingStub: () => _FakeFlutterAssetManager_9( + returnValueForMissingStub: () => _FakeFlutterAssetManager_10( this, Invocation.getter(#instanceFlutterAssetManager), ), @@ -1728,11 +1767,11 @@ class MockAndroidWebViewProxy extends _i1.Mock @override _i2.WebStorage Function() get instanceWebStorage => (super.noSuchMethod( Invocation.getter(#instanceWebStorage), - returnValue: () => _FakeWebStorage_10( + returnValue: () => _FakeWebStorage_11( this, Invocation.getter(#instanceWebStorage), ), - returnValueForMissingStub: () => _FakeWebStorage_10( + returnValueForMissingStub: () => _FakeWebStorage_11( this, Invocation.getter(#instanceWebStorage), ), @@ -1748,11 +1787,11 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock @override _i2.PigeonInstanceManager get instanceManager => (super.noSuchMethod( Invocation.getter(#instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#instanceManager), ), @@ -1762,11 +1801,11 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock _i5.PlatformViewsServiceProxy get platformViewsServiceProxy => (super.noSuchMethod( Invocation.getter(#platformViewsServiceProxy), - returnValue: _FakePlatformViewsServiceProxy_12( + returnValue: _FakePlatformViewsServiceProxy_13( this, Invocation.getter(#platformViewsServiceProxy), ), - returnValueForMissingStub: _FakePlatformViewsServiceProxy_12( + returnValueForMissingStub: _FakePlatformViewsServiceProxy_13( this, Invocation.getter(#platformViewsServiceProxy), ), @@ -1778,6 +1817,35 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock returnValue: false, returnValueForMissingStub: false, ) as bool); + + @override + _i3.PlatformWebViewController get controller => (super.noSuchMethod( + Invocation.getter(#controller), + returnValue: _FakePlatformWebViewController_14( + this, + Invocation.getter(#controller), + ), + returnValueForMissingStub: _FakePlatformWebViewController_14( + this, + Invocation.getter(#controller), + ), + ) as _i3.PlatformWebViewController); + + @override + _i4.TextDirection get layoutDirection => (super.noSuchMethod( + Invocation.getter(#layoutDirection), + returnValue: _i4.TextDirection.rtl, + returnValueForMissingStub: _i4.TextDirection.rtl, + ) as _i4.TextDirection); + + @override + Set<_i10.Factory<_i11.OneSequenceGestureRecognizer>> get gestureRecognizers => + (super.noSuchMethod( + Invocation.getter(#gestureRecognizers), + returnValue: <_i10.Factory<_i11.OneSequenceGestureRecognizer>>{}, + returnValueForMissingStub: <_i10 + .Factory<_i11.OneSequenceGestureRecognizer>>{}, + ) as Set<_i10.Factory<_i11.OneSequenceGestureRecognizer>>); } /// A class which mocks [ExpensiveAndroidViewController]. @@ -1809,11 +1877,11 @@ class MockExpensiveAndroidViewController extends _i1.Mock @override _i6.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), - returnValue: (_i4.Offset position) => _FakeOffset_5( + returnValue: (_i4.Offset position) => _FakeOffset_6( this, Invocation.getter(#pointTransformer), ), - returnValueForMissingStub: (_i4.Offset position) => _FakeOffset_5( + returnValueForMissingStub: (_i4.Offset position) => _FakeOffset_6( this, Invocation.getter(#pointTransformer), ), @@ -1877,14 +1945,14 @@ class MockExpensiveAndroidViewController extends _i1.Mock #setSize, [size], ), - returnValue: _i8.Future<_i4.Size>.value(_FakeSize_13( + returnValue: _i8.Future<_i4.Size>.value(_FakeSize_15( this, Invocation.method( #setSize, [size], ), )), - returnValueForMissingStub: _i8.Future<_i4.Size>.value(_FakeSize_13( + returnValueForMissingStub: _i8.Future<_i4.Size>.value(_FakeSize_15( this, Invocation.method( #setSize, @@ -1938,7 +2006,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock ) as _i8.Future); @override - _i8.Future dispatchPointerEvent(_i10.PointerEvent? event) => + _i8.Future dispatchPointerEvent(_i11.PointerEvent? event) => (super.noSuchMethod( Invocation.method( #dispatchPointerEvent, @@ -1977,11 +2045,11 @@ class MockFlutterAssetManager extends _i1.Mock @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2004,7 +2072,7 @@ class MockFlutterAssetManager extends _i1.Mock #getAssetFilePathByName, [name], ), - returnValue: _i8.Future.value(_i11.dummyValue( + returnValue: _i8.Future.value(_i12.dummyValue( this, Invocation.method( #getAssetFilePathByName, @@ -2012,7 +2080,7 @@ class MockFlutterAssetManager extends _i1.Mock ), )), returnValueForMissingStub: - _i8.Future.value(_i11.dummyValue( + _i8.Future.value(_i12.dummyValue( this, Invocation.method( #getAssetFilePathByName, @@ -2027,14 +2095,14 @@ class MockFlutterAssetManager extends _i1.Mock #pigeon_copy, [], ), - returnValue: _FakeFlutterAssetManager_9( + returnValue: _FakeFlutterAssetManager_10( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeFlutterAssetManager_9( + returnValueForMissingStub: _FakeFlutterAssetManager_10( this, Invocation.method( #pigeon_copy, @@ -2052,11 +2120,11 @@ class MockGeolocationPermissionsCallback extends _i1.Mock @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2087,14 +2155,14 @@ class MockGeolocationPermissionsCallback extends _i1.Mock #pigeon_copy, [], ), - returnValue: _FakeGeolocationPermissionsCallback_14( + returnValue: _FakeGeolocationPermissionsCallback_16( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeGeolocationPermissionsCallback_14( + returnValueForMissingStub: _FakeGeolocationPermissionsCallback_16( this, Invocation.method( #pigeon_copy, @@ -2111,11 +2179,11 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { @override String get channelName => (super.noSuchMethod( Invocation.getter(#channelName), - returnValue: _i11.dummyValue( + returnValue: _i12.dummyValue( this, Invocation.getter(#channelName), ), - returnValueForMissingStub: _i11.dummyValue( + returnValueForMissingStub: _i12.dummyValue( this, Invocation.getter(#channelName), ), @@ -2143,11 +2211,11 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2159,14 +2227,14 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { #pigeon_copy, [], ), - returnValue: _FakeJavaScriptChannel_7( + returnValue: _FakeJavaScriptChannel_8( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeJavaScriptChannel_7( + returnValueForMissingStub: _FakeJavaScriptChannel_8( this, Invocation.method( #pigeon_copy, @@ -2190,11 +2258,11 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2226,14 +2294,14 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { #pigeon_copy, [], ), - returnValue: _FakePermissionRequest_15( + returnValue: _FakePermissionRequest_17( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakePermissionRequest_15( + returnValueForMissingStub: _FakePermissionRequest_17( this, Invocation.method( #pigeon_copy, @@ -2271,7 +2339,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock #onFocus: onFocus, }, ), - returnValue: _FakeExpensiveAndroidViewController_16( + returnValue: _FakeExpensiveAndroidViewController_18( this, Invocation.method( #initExpensiveAndroidView, @@ -2286,7 +2354,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock }, ), ), - returnValueForMissingStub: _FakeExpensiveAndroidViewController_16( + returnValueForMissingStub: _FakeExpensiveAndroidViewController_18( this, Invocation.method( #initExpensiveAndroidView, @@ -2325,7 +2393,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock #onFocus: onFocus, }, ), - returnValue: _FakeSurfaceAndroidViewController_17( + returnValue: _FakeSurfaceAndroidViewController_19( this, Invocation.method( #initSurfaceAndroidView, @@ -2340,7 +2408,7 @@ class MockPlatformViewsServiceProxy extends _i1.Mock }, ), ), - returnValueForMissingStub: _FakeSurfaceAndroidViewController_17( + returnValueForMissingStub: _FakeSurfaceAndroidViewController_19( this, Invocation.method( #initSurfaceAndroidView, @@ -2387,11 +2455,11 @@ class MockSurfaceAndroidViewController extends _i1.Mock @override _i6.PointTransformer get pointTransformer => (super.noSuchMethod( Invocation.getter(#pointTransformer), - returnValue: (_i4.Offset position) => _FakeOffset_5( + returnValue: (_i4.Offset position) => _FakeOffset_6( this, Invocation.getter(#pointTransformer), ), - returnValueForMissingStub: (_i4.Offset position) => _FakeOffset_5( + returnValueForMissingStub: (_i4.Offset position) => _FakeOffset_6( this, Invocation.getter(#pointTransformer), ), @@ -2455,14 +2523,14 @@ class MockSurfaceAndroidViewController extends _i1.Mock #setSize, [size], ), - returnValue: _i8.Future<_i4.Size>.value(_FakeSize_13( + returnValue: _i8.Future<_i4.Size>.value(_FakeSize_15( this, Invocation.method( #setSize, [size], ), )), - returnValueForMissingStub: _i8.Future<_i4.Size>.value(_FakeSize_13( + returnValueForMissingStub: _i8.Future<_i4.Size>.value(_FakeSize_15( this, Invocation.method( #setSize, @@ -2516,7 +2584,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock ) as _i8.Future); @override - _i8.Future dispatchPointerEvent(_i10.PointerEvent? event) => + _i8.Future dispatchPointerEvent(_i11.PointerEvent? event) => (super.noSuchMethod( Invocation.method( #dispatchPointerEvent, @@ -2608,11 +2676,11 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2703,11 +2771,11 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2874,7 +2942,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { #getUserAgentString, [], ), - returnValue: _i8.Future.value(_i11.dummyValue( + returnValue: _i8.Future.value(_i12.dummyValue( this, Invocation.method( #getUserAgentString, @@ -2882,7 +2950,7 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { ), )), returnValueForMissingStub: - _i8.Future.value(_i11.dummyValue( + _i8.Future.value(_i12.dummyValue( this, Invocation.method( #getUserAgentString, @@ -2897,14 +2965,14 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { #pigeon_copy, [], ), - returnValue: _FakeWebSettings_18( + returnValue: _FakeWebSettings_20( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeWebSettings_18( + returnValueForMissingStub: _FakeWebSettings_20( this, Invocation.method( #pigeon_copy, @@ -2921,11 +2989,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i2.WebSettings get settings => (super.noSuchMethod( Invocation.getter(#settings), - returnValue: _FakeWebSettings_18( + returnValue: _FakeWebSettings_20( this, Invocation.getter(#settings), ), - returnValueForMissingStub: _FakeWebSettings_18( + returnValueForMissingStub: _FakeWebSettings_20( this, Invocation.getter(#settings), ), @@ -2934,11 +3002,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2950,14 +3018,14 @@ class MockWebView extends _i1.Mock implements _i2.WebView { #pigeonVar_settings, [], ), - returnValue: _FakeWebSettings_18( + returnValue: _FakeWebSettings_20( this, Invocation.method( #pigeonVar_settings, [], ), ), - returnValueForMissingStub: _FakeWebSettings_18( + returnValueForMissingStub: _FakeWebSettings_20( this, Invocation.method( #pigeonVar_settings, @@ -3028,7 +3096,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i8.Future postUrl( String? url, - _i12.Uint8List? data, + _i13.Uint8List? data, ) => (super.noSuchMethod( Invocation.method( @@ -3213,14 +3281,14 @@ class MockWebView extends _i1.Mock implements _i2.WebView { #pigeon_copy, [], ), - returnValue: _FakeWebView_6( + returnValue: _FakeWebView_7( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeWebView_6( + returnValueForMissingStub: _FakeWebView_7( this, Invocation.method( #pigeon_copy, @@ -3269,7 +3337,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { #getScrollPosition, [], ), - returnValue: _i8.Future<_i2.WebViewPoint>.value(_FakeWebViewPoint_19( + returnValue: _i8.Future<_i2.WebViewPoint>.value(_FakeWebViewPoint_21( this, Invocation.method( #getScrollPosition, @@ -3277,7 +3345,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { ), )), returnValueForMissingStub: - _i8.Future<_i2.WebViewPoint>.value(_FakeWebViewPoint_19( + _i8.Future<_i2.WebViewPoint>.value(_FakeWebViewPoint_21( this, Invocation.method( #getScrollPosition, @@ -3305,11 +3373,11 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -3357,11 +3425,11 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_11( + returnValue: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_11( + returnValueForMissingStub: _FakePigeonInstanceManager_12( this, Invocation.getter(#pigeon_instanceManager), ), @@ -3383,14 +3451,14 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { #pigeon_copy, [], ), - returnValue: _FakeWebStorage_10( + returnValue: _FakeWebStorage_11( this, Invocation.method( #pigeon_copy, [], ), ), - returnValueForMissingStub: _FakeWebStorage_10( + returnValueForMissingStub: _FakeWebStorage_11( this, Invocation.method( #pigeon_copy, From e46a9bf4aa1664664849e6b2fed4e404e94f9341 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 19:35:17 -0400 Subject: [PATCH 19/34] finish android tests --- .../test/android_navigation_delegate_test.dart | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart index b05d5ce1eecc..97ed60ae8fa0 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart @@ -682,6 +682,21 @@ void main() { await error.cancel(); verify(mockSslErrorHandler.cancel()); }); + + test('setOnSSlAuthError calls cancel by default', () async { + AndroidNavigationDelegate(_buildCreationParams()); + + final MockSslErrorHandler mockSslErrorHandler = MockSslErrorHandler(); + + CapturingWebViewClient.lastCreatedDelegate.onReceivedSslError!( + CapturingWebViewClient(), + TestWebView(), + mockSslErrorHandler, + MockSslError(), + ); + + verify(mockSslErrorHandler.cancel()); + }); }); } From a221ece2a9cd16ef5baade89987d12aad8310846 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 19:45:38 -0400 Subject: [PATCH 20/34] update proxy --- .../WebKitLibrary.g.swift | 8947 +++++++++++------ .../lib/src/common/web_kit.g.dart | 584 +- .../lib/src/webkit_proxy.dart | 28 + .../webview_flutter_wkwebview/pubspec.yaml | 6 +- 4 files changed, 6204 insertions(+), 3361 deletions(-) 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 dbb88c1696ae..d3850f328a71 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 @@ -6,9 +6,8 @@ import Foundation import WebKit - #if !os(macOS) - import UIKit +import UIKit #endif #if os(iOS) @@ -64,9 +63,7 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError( - code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", - details: "") + return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -84,6 +81,7 @@ protocol WebKitLibraryPigeonInternalFinalizerDelegate: AnyObject { func onDeinit(identifier: Int64) } + // Attaches to an object to receive a callback when the object is deallocated. internal final class WebKitLibraryPigeonInternalFinalizer { private static let associatedObjectKey = malloc(1)! @@ -99,8 +97,7 @@ internal final class WebKitLibraryPigeonInternalFinalizer { } internal static func attach( - to instance: AnyObject, identifier: Int64, - delegate: WebKitLibraryPigeonInternalFinalizerDelegate + to instance: AnyObject, identifier: Int64, delegate: WebKitLibraryPigeonInternalFinalizerDelegate ) { let finalizer = WebKitLibraryPigeonInternalFinalizer(identifier: identifier, delegate: delegate) objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) @@ -115,6 +112,7 @@ internal final class WebKitLibraryPigeonInternalFinalizer { } } + /// Maintains instances used to communicate with the corresponding objects in Dart. /// /// Objects stored in this container are represented by an object in Dart that is also stored in @@ -218,8 +216,7 @@ final class WebKitLibraryPigeonInstanceManager { identifiers.setObject(NSNumber(value: identifier), forKey: instance) weakInstances.setObject(instance, forKey: NSNumber(value: identifier)) strongInstances.setObject(instance, forKey: NSNumber(value: identifier)) - WebKitLibraryPigeonInternalFinalizer.attach( - to: instance, identifier: identifier, delegate: finalizerDelegate) + WebKitLibraryPigeonInternalFinalizer.attach(to: instance, identifier: identifier, delegate: finalizerDelegate) } /// Retrieves the identifier paired with an instance. @@ -296,6 +293,7 @@ final class WebKitLibraryPigeonInstanceManager { } } + private class WebKitLibraryPigeonInstanceManagerApi { /// The codec used for serializing messages. var codec: FlutterStandardMessageCodec { WebKitLibraryPigeonCodec.shared } @@ -308,14 +306,9 @@ private class WebKitLibraryPigeonInstanceManagerApi { } /// Sets up an instance of `WebKitLibraryPigeonInstanceManagerApi` to handle messages through the `binaryMessenger`. - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, instanceManager: WebKitLibraryPigeonInstanceManager? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, instanceManager: WebKitLibraryPigeonInstanceManager?) { let codec = WebKitLibraryPigeonCodec.shared - let removeStrongReferenceChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference", - binaryMessenger: binaryMessenger, codec: codec) + let removeStrongReferenceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference", binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { removeStrongReferenceChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -330,9 +323,7 @@ private class WebKitLibraryPigeonInstanceManagerApi { } else { removeStrongReferenceChannel.setMessageHandler(nil) } - let clearChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.clear", - binaryMessenger: binaryMessenger, codec: codec) + let clearChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.clear", binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { clearChannel.setMessageHandler { _, reply in do { @@ -348,13 +339,9 @@ private class WebKitLibraryPigeonInstanceManagerApi { } /// Sends a message to the Dart `InstanceManager` to remove the strong reference of the instance associated with `identifier`. - func removeStrongReference( - identifier identifierArg: Int64, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func removeStrongReference(identifier identifierArg: Int64, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([identifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -377,141 +364,111 @@ protocol WebKitLibraryPigeonProxyApiDelegate { func pigeonApiURLRequest(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLRequest /// An implementation of [PigeonApiHTTPURLResponse] used to add a new Dart instance of /// `HTTPURLResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiHTTPURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiHTTPURLResponse + func pigeonApiHTTPURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiHTTPURLResponse /// An implementation of [PigeonApiURLResponse] used to add a new Dart instance of /// `URLResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLResponse + func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLResponse /// An implementation of [PigeonApiWKUserScript] used to add a new Dart instance of /// `WKUserScript` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUserScript(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKUserScript + func pigeonApiWKUserScript(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUserScript /// An implementation of [PigeonApiWKNavigationAction] used to add a new Dart instance of /// `WKNavigationAction` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationAction(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKNavigationAction + func pigeonApiWKNavigationAction(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationAction /// An implementation of [PigeonApiWKNavigationResponse] used to add a new Dart instance of /// `WKNavigationResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKNavigationResponse + func pigeonApiWKNavigationResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationResponse /// An implementation of [PigeonApiWKFrameInfo] used to add a new Dart instance of /// `WKFrameInfo` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKFrameInfo(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKFrameInfo + func pigeonApiWKFrameInfo(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKFrameInfo /// An implementation of [PigeonApiNSError] used to add a new Dart instance of /// `NSError` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiNSError(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSError /// An implementation of [PigeonApiWKScriptMessage] used to add a new Dart instance of /// `WKScriptMessage` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKScriptMessage(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKScriptMessage + func pigeonApiWKScriptMessage(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKScriptMessage /// An implementation of [PigeonApiWKSecurityOrigin] used to add a new Dart instance of /// `WKSecurityOrigin` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKSecurityOrigin(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKSecurityOrigin + func pigeonApiWKSecurityOrigin(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKSecurityOrigin /// An implementation of [PigeonApiHTTPCookie] used to add a new Dart instance of /// `HTTPCookie` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiHTTPCookie(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiHTTPCookie /// An implementation of [PigeonApiAuthenticationChallengeResponse] used to add a new Dart instance of /// `AuthenticationChallengeResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiAuthenticationChallengeResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiAuthenticationChallengeResponse + func pigeonApiAuthenticationChallengeResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiAuthenticationChallengeResponse /// An implementation of [PigeonApiWKWebsiteDataStore] used to add a new Dart instance of /// `WKWebsiteDataStore` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKWebsiteDataStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKWebsiteDataStore + func pigeonApiWKWebsiteDataStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebsiteDataStore /// An implementation of [PigeonApiUIView] used to add a new Dart instance of /// `UIView` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiUIView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIView /// An implementation of [PigeonApiUIScrollView] used to add a new Dart instance of /// `UIScrollView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIScrollView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIScrollView + func pigeonApiUIScrollView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIScrollView /// An implementation of [PigeonApiWKWebViewConfiguration] used to add a new Dart instance of /// `WKWebViewConfiguration` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKWebViewConfiguration(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKWebViewConfiguration + func pigeonApiWKWebViewConfiguration(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebViewConfiguration /// An implementation of [PigeonApiWKUserContentController] used to add a new Dart instance of /// `WKUserContentController` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUserContentController(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKUserContentController + func pigeonApiWKUserContentController(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUserContentController /// An implementation of [PigeonApiWKPreferences] used to add a new Dart instance of /// `WKPreferences` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKPreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKPreferences + func pigeonApiWKPreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKPreferences /// An implementation of [PigeonApiWKScriptMessageHandler] used to add a new Dart instance of /// `WKScriptMessageHandler` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKScriptMessageHandler(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKScriptMessageHandler + func pigeonApiWKScriptMessageHandler(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKScriptMessageHandler /// An implementation of [PigeonApiWKNavigationDelegate] used to add a new Dart instance of /// `WKNavigationDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKNavigationDelegate + func pigeonApiWKNavigationDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationDelegate /// An implementation of [PigeonApiNSObject] used to add a new Dart instance of /// `NSObject` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiNSObject(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject /// An implementation of [PigeonApiUIViewWKWebView] used to add a new Dart instance of /// `UIViewWKWebView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIViewWKWebView + func pigeonApiUIViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIViewWKWebView /// An implementation of [PigeonApiNSViewWKWebView] used to add a new Dart instance of /// `NSViewWKWebView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiNSViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiNSViewWKWebView + func pigeonApiNSViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSViewWKWebView /// An implementation of [PigeonApiWKWebView] used to add a new Dart instance of /// `WKWebView` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebView /// An implementation of [PigeonApiWKUIDelegate] used to add a new Dart instance of /// `WKUIDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUIDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKUIDelegate + func pigeonApiWKUIDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUIDelegate /// An implementation of [PigeonApiWKHTTPCookieStore] used to add a new Dart instance of /// `WKHTTPCookieStore` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKHTTPCookieStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKHTTPCookieStore + func pigeonApiWKHTTPCookieStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKHTTPCookieStore /// An implementation of [PigeonApiUIScrollViewDelegate] used to add a new Dart instance of /// `UIScrollViewDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIScrollViewDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIScrollViewDelegate + func pigeonApiUIScrollViewDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIScrollViewDelegate /// An implementation of [PigeonApiURLCredential] used to add a new Dart instance of /// `URLCredential` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLCredential(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLCredential + func pigeonApiURLCredential(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLCredential /// An implementation of [PigeonApiURLProtectionSpace] used to add a new Dart instance of /// `URLProtectionSpace` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLProtectionSpace(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLProtectionSpace + func pigeonApiURLProtectionSpace(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLProtectionSpace /// An implementation of [PigeonApiURLAuthenticationChallenge] used to add a new Dart instance of /// `URLAuthenticationChallenge` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLAuthenticationChallenge(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLAuthenticationChallenge + func pigeonApiURLAuthenticationChallenge(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLAuthenticationChallenge /// 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 + func pigeonApiWKWebpagePreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebpagePreferences /// An implementation of [PigeonApiGetTrustResultResponse] used to add a new Dart instance of /// `GetTrustResultResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiGetTrustResultResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiGetTrustResultResponse + func pigeonApiGetTrustResultResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiGetTrustResultResponse /// An implementation of [PigeonApiSecTrust] used to add a new Dart instance of /// `SecTrust` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiSecTrust(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiSecTrust /// An implementation of [PigeonApiSecCertificate] used to add a new Dart instance of /// `SecCertificate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiSecCertificate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiSecCertificate + func pigeonApiSecCertificate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiSecCertificate } extension WebKitLibraryPigeonProxyApiDelegate { - func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLResponse - { - return PigeonApiURLResponse( - pigeonRegistrar: registrar, delegate: PigeonApiDelegateURLResponse()) + func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLResponse { + return PigeonApiURLResponse(pigeonRegistrar: registrar, delegate: PigeonApiDelegateURLResponse()) } func pigeonApiWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebView { return PigeonApiWKWebView(pigeonRegistrar: registrar, delegate: PigeonApiDelegateWKWebView()) @@ -556,74 +513,44 @@ open class WebKitLibraryPigeonProxyApiRegistrar { } func setUp() { - WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: instanceManager) - PigeonApiURLRequest.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLRequest(self)) - PigeonApiWKUserScript.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserScript(self)) - PigeonApiHTTPCookie.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiHTTPCookie(self)) - PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers( - binaryMessenger: binaryMessenger, - api: apiDelegate.pigeonApiAuthenticationChallengeResponse(self)) - PigeonApiWKWebsiteDataStore.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebsiteDataStore(self)) - PigeonApiUIView.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(self)) - PigeonApiUIScrollView.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollView(self)) - PigeonApiWKWebViewConfiguration.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebViewConfiguration(self)) - PigeonApiWKUserContentController.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserContentController(self)) - PigeonApiWKPreferences.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKPreferences(self)) - PigeonApiWKScriptMessageHandler.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKScriptMessageHandler(self)) - PigeonApiWKNavigationDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKNavigationDelegate(self)) - PigeonApiNSObject.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSObject(self)) - PigeonApiUIViewWKWebView.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewWKWebView(self)) - PigeonApiNSViewWKWebView.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSViewWKWebView(self)) - PigeonApiWKUIDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUIDelegate(self)) - PigeonApiWKHTTPCookieStore.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKHTTPCookieStore(self)) - PigeonApiUIScrollViewDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) - PigeonApiURLCredential.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) - PigeonApiURLProtectionSpace.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) - PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) - PigeonApiURL.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) - PigeonApiWKWebpagePreferences.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) - PigeonApiSecTrust.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecTrust(self)) - PigeonApiSecCertificate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecCertificate(self)) + WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager) + PigeonApiURLRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLRequest(self)) + PigeonApiWKUserScript.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserScript(self)) + PigeonApiHTTPCookie.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiHTTPCookie(self)) + PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiAuthenticationChallengeResponse(self)) + PigeonApiWKWebsiteDataStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebsiteDataStore(self)) + PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(self)) + PigeonApiUIScrollView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollView(self)) + PigeonApiWKWebViewConfiguration.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebViewConfiguration(self)) + PigeonApiWKUserContentController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserContentController(self)) + PigeonApiWKPreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKPreferences(self)) + PigeonApiWKScriptMessageHandler.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKScriptMessageHandler(self)) + PigeonApiWKNavigationDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKNavigationDelegate(self)) + PigeonApiNSObject.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSObject(self)) + PigeonApiUIViewWKWebView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewWKWebView(self)) + PigeonApiNSViewWKWebView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSViewWKWebView(self)) + PigeonApiWKUIDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUIDelegate(self)) + PigeonApiWKHTTPCookieStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKHTTPCookieStore(self)) + PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) + PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) + PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) + PigeonApiURLAuthenticationChallenge.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) + PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) + PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) + PigeonApiSecTrust.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecTrust(self)) + PigeonApiSecCertificate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecCertificate(self)) } func tearDown() { - WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: nil) + WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil) PigeonApiURLRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKUserScript.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiHTTPCookie.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: nil) + PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebsiteDataStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIScrollView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebViewConfiguration.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiWKUserContentController.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: nil) + PigeonApiWKUserContentController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKPreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKScriptMessageHandler.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKNavigationDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -635,8 +562,7 @@ open class WebKitLibraryPigeonProxyApiRegistrar { PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: nil) + PigeonApiURLAuthenticationChallenge.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiSecTrust.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -679,272 +605,252 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand } override func writeValue(_ value: Any) { - if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] - || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String - || value is KeyValueObservingOptions || value is KeyValueChange - || value is KeyValueChangeKey || value is UserScriptInjectionTime - || value is AudiovisualMediaType || value is WebsiteDataType - || value is NavigationActionPolicy || value is NavigationResponsePolicy - || value is HttpCookiePropertyKey || value is NavigationType || value is PermissionDecision - || value is MediaCaptureType || value is UrlSessionAuthChallengeDisposition - || value is UrlCredentialPersistence || value is DartSecTrustResultType - { + if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String || value is KeyValueObservingOptions || value is KeyValueChange || value is KeyValueChangeKey || value is UserScriptInjectionTime || value is AudiovisualMediaType || value is WebsiteDataType || value is NavigationActionPolicy || value is NavigationResponsePolicy || value is HttpCookiePropertyKey || value is NavigationType || value is PermissionDecision || value is MediaCaptureType || value is UrlSessionAuthChallengeDisposition || value is UrlCredentialPersistence || value is DartSecTrustResultType { super.writeValue(value) return } + if let instance = value as? URLRequestWrapper { pigeonRegistrar.apiDelegate.pigeonApiURLRequest(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? HTTPURLResponse { pigeonRegistrar.apiDelegate.pigeonApiHTTPURLResponse(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? URLResponse { pigeonRegistrar.apiDelegate.pigeonApiURLResponse(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKUserScript { pigeonRegistrar.apiDelegate.pigeonApiWKUserScript(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKNavigationAction { pigeonRegistrar.apiDelegate.pigeonApiWKNavigationAction(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKNavigationResponse { - pigeonRegistrar.apiDelegate.pigeonApiWKNavigationResponse(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKNavigationResponse(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKFrameInfo { pigeonRegistrar.apiDelegate.pigeonApiWKFrameInfo(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? NSError { pigeonRegistrar.apiDelegate.pigeonApiNSError(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKScriptMessage { pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessage(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKSecurityOrigin { pigeonRegistrar.apiDelegate.pigeonApiWKSecurityOrigin(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? HTTPCookie { pigeonRegistrar.apiDelegate.pigeonApiHTTPCookie(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? AuthenticationChallengeResponse { - pigeonRegistrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKWebsiteDataStore { pigeonRegistrar.apiDelegate.pigeonApiWKWebsiteDataStore(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? UIScrollView { - pigeonRegistrar.apiDelegate.pigeonApiUIScrollView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIScrollView { + pigeonRegistrar.apiDelegate.pigeonApiUIScrollView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? WKWebViewConfiguration { - pigeonRegistrar.apiDelegate.pigeonApiWKWebViewConfiguration(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKWebViewConfiguration(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKUserContentController { - pigeonRegistrar.apiDelegate.pigeonApiWKUserContentController(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKUserContentController(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKPreferences { pigeonRegistrar.apiDelegate.pigeonApiWKPreferences(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKScriptMessageHandler { - pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessageHandler(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessageHandler(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKNavigationDelegate { - pigeonRegistrar.apiDelegate.pigeonApiWKNavigationDelegate(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKNavigationDelegate(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? WKWebView { - pigeonRegistrar.apiDelegate.pigeonApiUIViewWKWebView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? WKWebView { + pigeonRegistrar.apiDelegate.pigeonApiUIViewWKWebView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif #if !os(macOS) - if let instance = value as? UIView { - pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIView { + pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif #if !os(iOS) - if let instance = value as? WKWebView { - pigeonRegistrar.apiDelegate.pigeonApiNSViewWKWebView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? WKWebView { + pigeonRegistrar.apiDelegate.pigeonApiNSViewWKWebView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? WKWebView { @@ -953,45 +859,42 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKUIDelegate { pigeonRegistrar.apiDelegate.pigeonApiWKUIDelegate(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKHTTPCookieStore { pigeonRegistrar.apiDelegate.pigeonApiWKHTTPCookieStore(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? UIScrollViewDelegate { - pigeonRegistrar.apiDelegate.pigeonApiUIScrollViewDelegate(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIScrollViewDelegate { + pigeonRegistrar.apiDelegate.pigeonApiUIScrollViewDelegate(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? URLCredential { @@ -1000,104 +903,100 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? URLProtectionSpace { pigeonRegistrar.apiDelegate.pigeonApiURLProtectionSpace(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? URLAuthenticationChallenge { - pigeonRegistrar.apiDelegate.pigeonApiURLAuthenticationChallenge(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiURLAuthenticationChallenge(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? URL { pigeonRegistrar.apiDelegate.pigeonApiURL(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if #available(iOS 13.0.0, macOS 10.15.0, *), let instance = value as? WKWebpagePreferences { - pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? GetTrustResultResponse { - pigeonRegistrar.apiDelegate.pigeonApiGetTrustResultResponse(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiGetTrustResultResponse(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? SecTrustWrapper { pigeonRegistrar.apiDelegate.pigeonApiSecTrust(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? SecCertificateWrapper { pigeonRegistrar.apiDelegate.pigeonApiSecCertificate(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? NSObject { pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } - if let instance = value as AnyObject?, - pigeonRegistrar.instanceManager.containsInstance(instance) + + if let instance = value as AnyObject?, pigeonRegistrar.instanceManager.containsInstance(instance) { super.writeByte(128) super.writeValue( @@ -1115,13 +1014,11 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand } override func reader(with data: Data) -> FlutterStandardReader { - return WebKitLibraryPigeonInternalProxyApiCodecReader( - data: data, pigeonRegistrar: pigeonRegistrar) + return WebKitLibraryPigeonInternalProxyApiCodecReader(data: data, pigeonRegistrar: pigeonRegistrar) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return WebKitLibraryPigeonInternalProxyApiCodecWriter( - data: data, pigeonRegistrar: pigeonRegistrar) + return WebKitLibraryPigeonInternalProxyApiCodecWriter(data: data, pigeonRegistrar: pigeonRegistrar) } } @@ -1582,36 +1479,27 @@ class WebKitLibraryPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable } protocol PigeonApiDelegateURLRequest { - func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws - -> URLRequestWrapper + func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws -> URLRequestWrapper /// The URL being requested. func getUrl(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? /// The HTTP request method. - func setHttpMethod( - pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws + func setHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws /// The HTTP request method. - func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws - -> String? + func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? /// The request body. - func setHttpBody( - pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, - body: FlutterStandardTypedData?) throws + func setHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, body: FlutterStandardTypedData?) throws /// The request body. - func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws - -> FlutterStandardTypedData? + func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> FlutterStandardTypedData? /// A dictionary containing all of the HTTP header fields for a request. - func setAllHttpHeaderFields( - pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) - throws + func setAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) throws /// A dictionary containing all of the HTTP header fields for a request. - func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) - throws -> [String: String]? + func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> [String: String]? } protocol PigeonApiProtocolURLRequest { } -final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { +final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLRequest ///An implementation of [NSObject] used to access callback methods @@ -1619,23 +1507,17 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLRequest) - { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLRequest) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLRequest? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLRequest?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1643,8 +1525,8 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { let urlArg = args[1] as! String do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: urlArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: urlArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1653,16 +1535,13 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let getUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getUrl", - binaryMessenger: binaryMessenger, codec: codec) + let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getUrl", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getUrlChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1671,17 +1550,14 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { getUrlChannel.setMessageHandler(nil) } - let setHttpMethodChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpMethod", - binaryMessenger: binaryMessenger, codec: codec) + let setHttpMethodChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpMethod", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setHttpMethodChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let methodArg: String? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setHttpMethod( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, method: methodArg) + try api.pigeonDelegate.setHttpMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg, method: methodArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1690,16 +1566,13 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { setHttpMethodChannel.setMessageHandler(nil) } - let getHttpMethodChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpMethod", - binaryMessenger: binaryMessenger, codec: codec) + let getHttpMethodChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpMethod", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHttpMethodChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getHttpMethod( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getHttpMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1708,17 +1581,14 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { getHttpMethodChannel.setMessageHandler(nil) } - let setHttpBodyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpBody", - binaryMessenger: binaryMessenger, codec: codec) + let setHttpBodyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpBody", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setHttpBodyChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let bodyArg: FlutterStandardTypedData? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setHttpBody( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, body: bodyArg) + try api.pigeonDelegate.setHttpBody(pigeonApi: api, pigeonInstance: pigeonInstanceArg, body: bodyArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1727,16 +1597,13 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { setHttpBodyChannel.setMessageHandler(nil) } - let getHttpBodyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpBody", - binaryMessenger: binaryMessenger, codec: codec) + let getHttpBodyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpBody", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHttpBodyChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getHttpBody( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getHttpBody(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1745,17 +1612,14 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { getHttpBodyChannel.setMessageHandler(nil) } - let setAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setAllHttpHeaderFields", - binaryMessenger: binaryMessenger, codec: codec) + let setAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setAllHttpHeaderFields", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAllHttpHeaderFieldsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let fieldsArg: [String: String]? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setAllHttpHeaderFields( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, fields: fieldsArg) + try api.pigeonDelegate.setAllHttpHeaderFields(pigeonApi: api, pigeonInstance: pigeonInstanceArg, fields: fieldsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1764,16 +1628,13 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { setAllHttpHeaderFieldsChannel.setMessageHandler(nil) } - let getAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getAllHttpHeaderFields", - binaryMessenger: binaryMessenger, codec: codec) + let getAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getAllHttpHeaderFields", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAllHttpHeaderFieldsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getAllHttpHeaderFields( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAllHttpHeaderFields(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1785,26 +1646,21 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } ///Creates a Dart instance of URLRequest and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLRequestWrapper, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLRequestWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -1822,16 +1678,197 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URLRequest`. +/// +/// 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 URLRequestWrapperProxyAPIDelegate : PigeonApiDelegateURLRequest { + func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws -> URLRequestWrapper { + return URLRequest(,url: url) + } + + func getUrl(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? { + return pigeonInstance.url + } + + func setHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws { + pigeonInstance.httpMethod = method: method + } + + func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? { + return pigeonInstance.httpMethod + } + + func setHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, body: FlutterStandardTypedData?) throws { + pigeonInstance.httpBody = body: body + } + + func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> FlutterStandardTypedData? { + return pigeonInstance.httpBody + } + + func setAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) throws { + pigeonInstance.allHttpHeaderFields = fields: fields + } + + func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> [String: String]? { + return pigeonInstance.allHttpHeaderFields + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLRequestWrapperProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: "myString") + XCTAssertNotNil(instance) + } + + func testGetUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getUrlCalled) + XCTAssertEqual(value, instance.getUrl()) + } + + func testSetHttpMethod() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let method = "myString" + api.pigeonDelegate.setHttpMethod(pigeonApi: api, pigeonInstance: instance, method: method) + + XCTAssertEqual(instance.setHttpMethodArgs, [method]) + } + + func testGetHttpMethod() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let value = api.pigeonDelegate.getHttpMethod(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getHttpMethodCalled) + XCTAssertEqual(value, instance.getHttpMethod()) + } + + func testSetHttpBody() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let body = byteArrayOf(0xA1.toByte()) + api.pigeonDelegate.setHttpBody(pigeonApi: api, pigeonInstance: instance, body: body) + + XCTAssertEqual(instance.setHttpBodyArgs, [body]) + } + + func testGetHttpBody() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let value = api.pigeonDelegate.getHttpBody(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getHttpBodyCalled) + XCTAssertEqual(value, instance.getHttpBody()) + } + + func testSetAllHttpHeaderFields() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let fields = ["myString": "myString"] + api.pigeonDelegate.setAllHttpHeaderFields(pigeonApi: api, pigeonInstance: instance, fields: fields) + + XCTAssertEqual(instance.setAllHttpHeaderFieldsArgs, [fields]) + } + + func testGetAllHttpHeaderFields() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let value = api.pigeonDelegate.getAllHttpHeaderFields(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getAllHttpHeaderFieldsCalled) + XCTAssertEqual(value, instance.getAllHttpHeaderFields()) + } + +} +class TestURLRequestWrapper: URLRequest { + var getUrlCalled = false + var setHttpMethodArgs: [AnyHashable?]? = nil + var getHttpMethodCalled = false + var setHttpBodyArgs: [AnyHashable?]? = nil + var getHttpBodyCalled = false + var setAllHttpHeaderFieldsArgs: [AnyHashable?]? = nil + var getAllHttpHeaderFieldsCalled = false + + + override func getUrl() { + getUrlCalled = true + } + override func setHttpMethod() { + setHttpMethodArgs = [method] + } + override func getHttpMethod() { + getHttpMethodCalled = true + } + override func setHttpBody() { + setHttpBodyArgs = [body] + } + override func getHttpBody() { + getHttpBodyCalled = true + } + override func setAllHttpHeaderFields() { + setAllHttpHeaderFieldsArgs = [fields] + } + override func getAllHttpHeaderFields() { + getAllHttpHeaderFieldsCalled = true + } +} +*/ + protocol PigeonApiDelegateHTTPURLResponse { /// The response’s HTTP status code. - func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws - -> Int64 + func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 } protocol PigeonApiProtocolHTTPURLResponse { } -final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { +final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateHTTPURLResponse ///An implementation of [URLResponse] used to access callback methods @@ -1839,36 +1876,27 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { return pigeonRegistrar.apiDelegate.pigeonApiURLResponse(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateHTTPURLResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPURLResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of HTTPURLResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: HTTPURLResponse, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: HTTPURLResponse, 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) { + } 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) + } 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) + 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))) @@ -1886,13 +1914,60 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `HTTPURLResponse`. +/// +/// 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 HTTPURLResponseProxyAPIDelegate : PigeonApiDelegateHTTPURLResponse { + func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 { + return pigeonInstance.statusCode + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class HTTPURLResponseProxyAPITests: XCTestCase { + func testStatusCode() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiHTTPURLResponse(registrar) + + let instance = TestHTTPURLResponse() + let value = try? api.pigeonDelegate.statusCode(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.statusCode) + } + +} +*/ + open class PigeonApiDelegateURLResponse { } protocol PigeonApiProtocolURLResponse { } -final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { +final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLResponse ///An implementation of [NSObject] used to access callback methods @@ -1900,33 +1975,26 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of URLResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLResponse, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLResponse, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -1947,25 +2015,20 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { protocol PigeonApiDelegateWKUserScript { /// Creates a user script object that contains the specified source code and /// attributes. - func pigeonDefaultConstructor( - pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, - isForMainFrameOnly: Bool - ) throws -> WKUserScript + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, isForMainFrameOnly: Bool) throws -> WKUserScript /// The script’s source code. func source(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> String /// The time at which to inject the script into the webpage. - func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws - -> UserScriptInjectionTime + func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> UserScriptInjectionTime /// A Boolean value that indicates whether to inject the script into the main /// frame or all frames. - func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws - -> Bool + func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> Bool } protocol PigeonApiProtocolWKUserScript { } -final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { +final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUserScript ///An implementation of [NSObject] used to access callback methods @@ -1973,24 +2036,17 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserScript - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserScript) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserScript? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserScript?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2000,10 +2056,8 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { let isForMainFrameOnlyArg = args[3] as! Bool do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, source: sourceArg, injectionTime: injectionTimeArg, - isForMainFrameOnly: isForMainFrameOnlyArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, source: sourceArg, injectionTime: injectionTimeArg, isForMainFrameOnly: isForMainFrameOnlyArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2015,34 +2069,25 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { } ///Creates a Dart instance of WKUserScript and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKUserScript, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKUserScript, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2059,72 +2104,151 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { } } } -protocol PigeonApiDelegateWKNavigationAction { - /// The URL request object associated with the navigation action. - func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws - -> URLRequestWrapper - /// The frame in which to display the new content. - /// - /// If the target of the navigation is a new window, this property is nil. - func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) - throws -> WKFrameInfo? - /// The type of action that triggered the navigation. - func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) - throws -> NavigationType -} -protocol PigeonApiProtocolWKNavigationAction { -} +/* +// 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. -final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { - unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateWKNavigationAction - ///An implementation of [NSObject] used to access callback methods - var pigeonApiNSObject: PigeonApiNSObject { - return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) +import Foundation +import WebKit + + +/// ProxyApi implementation for `WKUserScript`. +/// +/// 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 UserScriptProxyAPIDelegate : PigeonApiDelegateWKUserScript { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, isForMainFrameOnly: Bool) throws -> WKUserScript { + return WKUserScript() } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKNavigationAction - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate + func source(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> String { + return pigeonInstance.source } - ///Creates a Dart instance of WKNavigationAction and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKNavigationAction, 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 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 { + + func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> UserScriptInjectionTime { + switch pigeonInstance.injectionTime { + case .atDocumentStart: + return .atDocumentStart + case .atDocumentEnd: + return .atDocumentEnd + @unknown default: + return .unknown + } + } + + func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> Bool { + return pigeonInstance.isForMainFrameOnly + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class UserScriptProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api source: "myString", injectionTime: .atDocumentStart, isForMainFrameOnly: true) + XCTAssertNotNil(instance) + } + + func testSource() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) + + let instance = TestUserScript() + let value = try? api.pigeonDelegate.source(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.source) + } + + func testInjectionTime() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) + + let instance = TestUserScript() + let value = try? api.pigeonDelegate.injectionTime(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.injectionTime) + } + + func testIsForMainFrameOnly() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) + + let instance = TestUserScript() + let value = try? api.pigeonDelegate.isForMainFrameOnly(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.isForMainFrameOnly) + } + +} +*/ + +protocol PigeonApiDelegateWKNavigationAction { + /// The URL request object associated with the navigation action. + func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper + /// The frame in which to display the new content. + /// + /// If the target of the navigation is a new window, this property is nil. + func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> WKFrameInfo? + /// The type of action that triggered the navigation. + func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> NavigationType +} + +protocol PigeonApiProtocolWKNavigationAction { +} + +final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { + unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar + let pigeonDelegate: PigeonApiDelegateWKNavigationAction + ///An implementation of [NSObject] used to access callback methods + var pigeonApiNSObject: PigeonApiNSObject { + return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) + } + + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationAction) { + self.pigeonRegistrar = pigeonRegistrar + self.pigeonDelegate = delegate + } + ///Creates a Dart instance of WKNavigationAction and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKNavigationAction, 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 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]) @@ -2136,21 +2260,108 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKNavigationAction`. +/// +/// 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 NavigationActionProxyAPIDelegate : PigeonApiDelegateWKNavigationAction { + func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper { + return pigeonInstance.request + } + + func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> WKFrameInfo? { + return pigeonInstance.targetFrame + } + + func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> NavigationType { + switch pigeonInstance.navigationType { + case .linkActivated: + return .linkActivated + case .formSubmitted: + return .formSubmitted + case .backForward: + return .backForward + case .reload: + return .reload + case .formResubmitted: + return .formResubmitted + case .other: + return .other + @unknown default: + return .unknown + } + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class NavigationActionProxyAPITests: XCTestCase { + func testRequest() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) + + let instance = TestNavigationAction() + let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.request) + } + + func testTargetFrame() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) + + let instance = TestNavigationAction() + let value = try? api.pigeonDelegate.targetFrame(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.targetFrame) + } + + func testNavigationType() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) + + let instance = TestNavigationAction() + let value = try? api.pigeonDelegate.navigationType(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.navigationType) + } + +} +*/ + protocol PigeonApiDelegateWKNavigationResponse { /// The frame’s response. - func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) - throws -> URLResponse + func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse /// A Boolean value that indicates whether the response targets the web view’s /// main frame. - func isForMainFrame( - pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse - ) throws -> Bool + func isForMainFrame(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> Bool } protocol PigeonApiProtocolWKNavigationResponse { } -final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse { +final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationResponse ///An implementation of [NSObject] used to access callback methods @@ -2158,40 +2369,29 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKNavigationResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKNavigationResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKNavigationResponse, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKNavigationResponse, 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) { + } 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) + } 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 + 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 @@ -2208,19 +2408,79 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKNavigationResponse`. +/// +/// 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 NavigationResponseProxyAPIDelegate : PigeonApiDelegateWKNavigationResponse { + func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse { + return pigeonInstance.response + } + + func isForMainFrame(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> Bool { + return pigeonInstance.isForMainFrame + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class NavigationResponseProxyAPITests: XCTestCase { + func testResponse() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationResponse(registrar) + + let instance = TestNavigationResponse() + let value = try? api.pigeonDelegate.response(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.response) + } + + func testIsForMainFrame() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationResponse(registrar) + + let instance = TestNavigationResponse() + let value = try? api.pigeonDelegate.isForMainFrame(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.isForMainFrame) + } + +} +*/ + protocol PigeonApiDelegateWKFrameInfo { /// A Boolean value indicating whether the frame is the web site's main frame /// or a subframe. func isMainFrame(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> Bool /// The frame’s current request. - func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws - -> URLRequestWrapper? + func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> URLRequestWrapper? } protocol PigeonApiProtocolWKFrameInfo { } -final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { +final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKFrameInfo ///An implementation of [NSObject] used to access callback methods @@ -2228,36 +2488,28 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKFrameInfo - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKFrameInfo) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKFrameInfo and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKFrameInfo, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKFrameInfo, 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) { + } 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) + } 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) + 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))) @@ -2275,6 +2527,67 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKFrameInfo`. +/// +/// 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 FrameInfoProxyAPIDelegate : PigeonApiDelegateWKFrameInfo { + func isMainFrame(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> Bool { + return pigeonInstance.isMainFrame + } + + func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> URLRequestWrapper? { + return pigeonInstance.request + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class FrameInfoProxyAPITests: XCTestCase { + func testIsMainFrame() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) + + let instance = TestFrameInfo() + let value = try? api.pigeonDelegate.isMainFrame(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.isMainFrame) + } + + func testRequest() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) + + let instance = TestFrameInfo() + let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.request) + } + +} +*/ + protocol PigeonApiDelegateNSError { /// The error code. func code(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> Int64 @@ -2287,7 +2600,7 @@ protocol PigeonApiDelegateNSError { protocol PigeonApiProtocolNSError { } -final class PigeonApiNSError: PigeonApiProtocolNSError { +final class PigeonApiNSError: PigeonApiProtocolNSError { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSError ///An implementation of [NSObject] used to access callback methods @@ -2300,32 +2613,25 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { self.pigeonDelegate = delegate } ///Creates a Dart instance of NSError and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: NSError, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: NSError, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2342,6 +2648,81 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `NSError`. +/// +/// 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 ErrorProxyAPIDelegate : PigeonApiDelegateNSError { + func code(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> Int64 { + return pigeonInstance.code + } + + func domain(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> String { + return pigeonInstance.domain + } + + func userInfo(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> [String: Any?] { + return pigeonInstance.userInfo + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ErrorProxyAPITests: XCTestCase { + func testCode() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSError(registrar) + + let instance = TestError() + let value = try? api.pigeonDelegate.code(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.code) + } + + func testDomain() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSError(registrar) + + let instance = TestError() + let value = try? api.pigeonDelegate.domain(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.domain) + } + + func testUserInfo() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSError(registrar) + + let instance = TestError() + let value = try? api.pigeonDelegate.userInfo(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.userInfo) + } + +} +*/ + protocol PigeonApiDelegateWKScriptMessage { /// The name of the message handler to which the message is sent. func name(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> String @@ -2352,7 +2733,7 @@ protocol PigeonApiDelegateWKScriptMessage { protocol PigeonApiProtocolWKScriptMessage { } -final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { +final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKScriptMessage ///An implementation of [NSObject] used to access callback methods @@ -2360,36 +2741,28 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKScriptMessage - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKScriptMessage) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKScriptMessage and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKScriptMessage, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKScriptMessage, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -2407,61 +2780,111 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { } } } -protocol PigeonApiDelegateWKSecurityOrigin { - /// The security origin’s host. - func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String - /// The security origin's port. - func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 - /// The security origin's protocol. - func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) - throws -> String -} -protocol PigeonApiProtocolWKSecurityOrigin { -} +/* +// 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. -final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { - unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateWKSecurityOrigin - ///An implementation of [NSObject] used to access callback methods - var pigeonApiNSObject: PigeonApiNSObject { - return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) +import Foundation +import WebKit + + +/// ProxyApi implementation for `WKScriptMessage`. +/// +/// 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 ScriptMessageProxyAPIDelegate : PigeonApiDelegateWKScriptMessage { + func name(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> String { + return pigeonInstance.name } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKSecurityOrigin - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate + func body(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> Any? { + return pigeonInstance.body } - ///Creates a Dart instance of WKSecurityOrigin and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKSecurityOrigin, completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ScriptMessageProxyAPITests: XCTestCase { + func testName() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKScriptMessage(registrar) + + let instance = TestScriptMessage() + let value = try? api.pigeonDelegate.name(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.name) + } + + func testBody() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKScriptMessage(registrar) + + let instance = TestScriptMessage() + let value = try? api.pigeonDelegate.body(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.body) + } + +} +*/ + +protocol PigeonApiDelegateWKSecurityOrigin { + /// The security origin’s host. + func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String + /// The security origin's port. + func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 + /// The security origin's protocol. + func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String +} + +protocol PigeonApiProtocolWKSecurityOrigin { +} + +final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { + unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar + let pigeonDelegate: PigeonApiDelegateWKSecurityOrigin + ///An implementation of [NSObject] used to access callback methods + var pigeonApiNSObject: PigeonApiNSObject { + return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) + } + + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKSecurityOrigin) { + self.pigeonRegistrar = pigeonRegistrar + self.pigeonDelegate = delegate + } + ///Creates a Dart instance of WKSecurityOrigin and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKSecurityOrigin, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2478,19 +2901,91 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKSecurityOrigin`. +/// +/// 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 SecurityOriginProxyAPIDelegate : PigeonApiDelegateWKSecurityOrigin { + func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String { + return pigeonInstance.host + } + + func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 { + return pigeonInstance.port + } + + func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String { + return pigeonInstance.securityProtocol + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class SecurityOriginProxyAPITests: XCTestCase { + func testHost() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) + + let instance = TestSecurityOrigin() + let value = try? api.pigeonDelegate.host(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.host) + } + + func testPort() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) + + let instance = TestSecurityOrigin() + let value = try? api.pigeonDelegate.port(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.port) + } + + func testSecurityProtocol() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) + + let instance = TestSecurityOrigin() + let value = try? api.pigeonDelegate.securityProtocol(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.securityProtocol) + } + +} +*/ + protocol PigeonApiDelegateHTTPCookie { - func pigeonDefaultConstructor( - pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any] - ) throws -> HTTPCookie + func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie /// The cookie’s properties. - func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws - -> [HttpCookiePropertyKey: Any]? + func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws -> [HttpCookiePropertyKey: Any]? } protocol PigeonApiProtocolHTTPCookie { } -final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { +final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateHTTPCookie ///An implementation of [NSObject] used to access callback methods @@ -2498,23 +2993,17 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPCookie) - { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPCookie) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiHTTPCookie? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiHTTPCookie?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2522,9 +3011,8 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { let propertiesArg = args[1] as? [HttpCookiePropertyKey: Any] do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, properties: propertiesArg!), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, properties: propertiesArg!), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2533,16 +3021,13 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let getPropertiesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.getProperties", - binaryMessenger: binaryMessenger, codec: codec) + let getPropertiesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.getProperties", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getPropertiesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! HTTPCookie do { - let result = try api.pigeonDelegate.getProperties( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getProperties(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -2554,26 +3039,21 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { } ///Creates a Dart instance of HTTPCookie and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: HTTPCookie, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: HTTPCookie, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -2591,52 +3071,100 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `HTTPCookie`. +/// +/// 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 HTTPCookieProxyAPIDelegate : PigeonApiDelegateHTTPCookie { + func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie { + return HTTPCookie(,properties: properties) + } + + func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws -> [HttpCookiePropertyKey: Any]? { + return pigeonInstance.properties + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class HTTPCookieProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiHTTPCookie(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, properties: [.comment: -1]) + XCTAssertNotNil(instance) + } + + func testGetProperties() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiHTTPCookie(registrar) + + let instance = TestHTTPCookie() + let value = api.pigeonDelegate.getProperties(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getPropertiesCalled) + XCTAssertEqual(value, instance.getProperties()) + } + +} +class TestHTTPCookie: HTTPCookie { + var getPropertiesCalled = false + + + override func getProperties() { + getPropertiesCalled = true + } +} +*/ + protocol PigeonApiDelegateAuthenticationChallengeResponse { - func pigeonDefaultConstructor( - pigeonApi: PigeonApiAuthenticationChallengeResponse, - disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential? - ) throws -> AuthenticationChallengeResponse + func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse /// The option to use to handle the challenge. - func disposition( - pigeonApi: PigeonApiAuthenticationChallengeResponse, - pigeonInstance: AuthenticationChallengeResponse - ) throws -> UrlSessionAuthChallengeDisposition + func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition /// The credential to use for authentication when the disposition parameter /// contains the value URLSession.AuthChallengeDisposition.useCredential. - func credential( - pigeonApi: PigeonApiAuthenticationChallengeResponse, - pigeonInstance: AuthenticationChallengeResponse - ) throws -> URLCredential? + func credential(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> URLCredential? } protocol PigeonApiProtocolAuthenticationChallengeResponse { } -final class PigeonApiAuthenticationChallengeResponse: - PigeonApiProtocolAuthenticationChallengeResponse -{ +final class PigeonApiAuthenticationChallengeResponse: PigeonApiProtocolAuthenticationChallengeResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateAuthenticationChallengeResponse - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateAuthenticationChallengeResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateAuthenticationChallengeResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiAuthenticationChallengeResponse? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiAuthenticationChallengeResponse?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2645,9 +3173,8 @@ final class PigeonApiAuthenticationChallengeResponse: let credentialArg: URLCredential? = nilOrValue(args[2]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, disposition: dispositionArg, credential: credentialArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, disposition: dispositionArg, credential: credentialArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2659,33 +3186,24 @@ final class PigeonApiAuthenticationChallengeResponse: } ///Creates a Dart instance of AuthenticationChallengeResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: AuthenticationChallengeResponse, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: AuthenticationChallengeResponse, 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) { + } 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) + } 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 + 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 @@ -2702,23 +3220,103 @@ final class PigeonApiAuthenticationChallengeResponse: } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `AuthenticationChallengeResponse`. +/// +/// 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 AuthenticationChallengeResponseProxyAPIDelegate : PigeonApiDelegateAuthenticationChallengeResponse { + func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse { + return AuthenticationChallengeResponse() + } + + func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition { + switch pigeonInstance.disposition { + case .useCredential: + return .useCredential + case .performDefaultHandling: + return .performDefaultHandling + case .cancelAuthenticationChallenge: + return .cancelAuthenticationChallenge + case .rejectProtectionSpace: + return .rejectProtectionSpace + @unknown default: + return .unknown + } + } + + func credential(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> URLCredential? { + return pigeonInstance.credential + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class AuthenticationChallengeResponseProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api disposition: .useCredential, credential: TestURLCredential) + XCTAssertNotNil(instance) + } + + func testDisposition() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) + + let instance = TestAuthenticationChallengeResponse() + let value = try? api.pigeonDelegate.disposition(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.disposition) + } + + func testCredential() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) + + let instance = TestAuthenticationChallengeResponse() + let value = try? api.pigeonDelegate.credential(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.credential) + } + +} +*/ + protocol PigeonApiDelegateWKWebsiteDataStore { /// The default data store, which stores data persistently to disk. func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore) throws -> WKWebsiteDataStore /// The object that manages the HTTP cookies for your website. - func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore) - throws -> WKHTTPCookieStore + func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore) throws -> WKHTTPCookieStore /// Removes the specified types of website data from one or more data records. - func removeDataOfTypes( - pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, - dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, - completion: @escaping (Result) -> Void) + func removeDataOfTypes(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolWKWebsiteDataStore { } -final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { +final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebsiteDataStore ///An implementation of [NSObject] used to access callback methods @@ -2726,33 +3324,23 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKWebsiteDataStore - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebsiteDataStore) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebsiteDataStore? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebsiteDataStore?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let defaultDataStoreChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.defaultDataStore", - binaryMessenger: binaryMessenger, codec: codec) + let defaultDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.defaultDataStore", binaryMessenger: binaryMessenger, codec: codec) if let api = api { defaultDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.defaultDataStore(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.defaultDataStore(pigeonApi: api), withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2761,19 +3349,14 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } else { defaultDataStoreChannel.setMessageHandler(nil) } - let httpCookieStoreChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.httpCookieStore", - binaryMessenger: binaryMessenger, codec: codec) + let httpCookieStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.httpCookieStore", binaryMessenger: binaryMessenger, codec: codec) if let api = api { httpCookieStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebsiteDataStore let pigeonIdentifierArg = args[1] as! Int64 do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.httpCookieStore( - pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.httpCookieStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2782,19 +3365,14 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } else { httpCookieStoreChannel.setMessageHandler(nil) } - let removeDataOfTypesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.removeDataOfTypes", - binaryMessenger: binaryMessenger, codec: codec) + let removeDataOfTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.removeDataOfTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeDataOfTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebsiteDataStore let dataTypesArg = args[1] as! [WebsiteDataType] let modificationTimeInSecondsSinceEpochArg = args[2] as! Double - api.pigeonDelegate.removeDataOfTypes( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataTypes: dataTypesArg, - modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpochArg - ) { result in + api.pigeonDelegate.removeDataOfTypes(pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataTypes: dataTypesArg, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpochArg) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2809,26 +3387,21 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } ///Creates a Dart instance of WKWebsiteDataStore and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebsiteDataStore, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKWebsiteDataStore, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -2846,22 +3419,102 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKWebsiteDataStore`. +/// +/// 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 WebsiteDataStoreProxyAPIDelegate : PigeonApiDelegateWKWebsiteDataStore { + func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore): WKWebsiteDataStore { + return WKWebsiteDataStore.defaultDataStore + } + + func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore): WKHTTPCookieStore { + return pigeonInstance.httpCookieStore + } + + func removeDataOfTypes(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, completion: @escaping (Result) -> Void) { + return pigeonInstance.removeDataOfTypes(dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebsiteDataStoreProxyAPITests: XCTestCase { + func testHttpCookieStore() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebsiteDataStore(registrar) + + let instance = TestWebsiteDataStore() + let value = try? api.pigeonDelegate.httpCookieStore(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.httpCookieStore) + } + + func testRemoveDataOfTypes() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebsiteDataStore(registrar) + + let instance = TestWebsiteDataStore() + let dataTypes = [.cookies] + let modificationTimeInSecondsSinceEpoch = 1.0 + let value = api.pigeonDelegate.removeDataOfTypes(pigeonApi: api, pigeonInstance: instance, dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch) + + XCTAssertEqual(instance.removeDataOfTypesArgs, [dataTypes, modificationTimeInSecondsSinceEpoch]) + XCTAssertEqual(value, instance.removeDataOfTypes(dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch)) + } + +} +class TestWebsiteDataStore: WKWebsiteDataStore { + private var httpCookieStoreTestValue = TestHTTPCookieStore + var removeDataOfTypesArgs: [AnyHashable?]? = nil + + override var httpCookieStore: WKHTTPCookieStore { + return httpCookieStoreTestValue + } + + override func removeDataOfTypes() { + removeDataOfTypesArgs = [dataTypes, modificationTimeInSecondsSinceEpoch] + return true + } +} +*/ + protocol PigeonApiDelegateUIView { #if !os(macOS) - /// The view’s background color. - func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) - throws + /// The view’s background color. + func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) throws #endif #if !os(macOS) - /// A Boolean value that determines whether the view is opaque. - func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws + /// A Boolean value that determines whether the view is opaque. + func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws #endif } protocol PigeonApiProtocolUIView { } -final class PigeonApiUIView: PigeonApiProtocolUIView { +final class PigeonApiUIView: PigeonApiProtocolUIView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIView ///An implementation of [NSObject] used to access callback methods @@ -2877,162 +3530,215 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let setBackgroundColorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setBackgroundColor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBackgroundColorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIView - let valueArg: Int64? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setBackgroundColor( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setBackgroundColorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setBackgroundColor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBackgroundColorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIView + let valueArg: Int64? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setBackgroundColor(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setBackgroundColorChannel.setMessageHandler(nil) } + } else { + setBackgroundColorChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setOpaqueChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setOpaque", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setOpaqueChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIView - let opaqueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setOpaque( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, opaque: opaqueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setOpaqueChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setOpaque", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setOpaqueChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIView + let opaqueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setOpaque(pigeonApi: api, pigeonInstance: pigeonInstanceArg, opaque: opaqueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setOpaqueChannel.setMessageHandler(nil) } + } else { + setOpaqueChannel.setMessageHandler(nil) + } #endif } #if !os(macOS) - ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: UIView, 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.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(())) - } - } - } - } - #endif + ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: UIView, 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.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(())) + } + } + } + } + #endif +} + +/* +// 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 Foundation +import UIKit + + +/// ProxyApi implementation for `UIView`. +/// +/// 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 ViewProxyAPIDelegate : PigeonApiDelegateUIView { + func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) throws { + pigeonInstance.backgroundColor = value: value + } + + func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws { + pigeonInstance.opaque = opaque: opaque + } + +} +*/ + +/* +// 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 UIKit +import Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ViewProxyAPITests: XCTestCase { + func testSetBackgroundColor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIView(registrar) + + let instance = TestView() + let value = 0 + api.pigeonDelegate.setBackgroundColor(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setBackgroundColorArgs, [value]) + } + + func testSetOpaque() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIView(registrar) + + let instance = TestView() + let opaque = true + api.pigeonDelegate.setOpaque(pigeonApi: api, pigeonInstance: instance, opaque: opaque) + + XCTAssertEqual(instance.setOpaqueArgs, [opaque]) + } + } +class TestView: UIView { + var setBackgroundColorArgs: [AnyHashable?]? = nil + var setOpaqueArgs: [AnyHashable?]? = nil + + + override func setBackgroundColor() { + setBackgroundColorArgs = [value] + } + override func setOpaque() { + setOpaqueArgs = [opaque] + } +} +*/ + protocol PigeonApiDelegateUIScrollView { #if !os(macOS) - /// The point at which the origin of the content view is offset from the - /// origin of the scroll view. - func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws - -> [Double] + /// The point at which the origin of the content view is offset from the + /// origin of the scroll view. + func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws -> [Double] #endif #if !os(macOS) - /// Move the scrolled position of your view. - /// - /// Convenience method to synchronize change to the x and y scroll position. - func scrollBy( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws + /// Move the scrolled position of your view. + /// + /// Convenience method to synchronize change to the x and y scroll position. + func scrollBy(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws #endif #if !os(macOS) - /// The point at which the origin of the content view is offset from the - /// origin of the scroll view. - func setContentOffset( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws + /// The point at which the origin of the content view is offset from the + /// origin of the scroll view. + func setContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws #endif #if !os(macOS) - /// The delegate of the scroll view. - func setDelegate( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, - delegate: UIScrollViewDelegate?) throws + /// The delegate of the scroll view. + func setDelegate(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, delegate: UIScrollViewDelegate?) throws #endif #if !os(macOS) - /// Whether the scroll view bounces past the edge of content and back again. - func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) - throws + /// Whether the scroll view bounces past the edge of content and back again. + func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether the scroll view bounces when it reaches the ends of its horizontal - /// axis. - func setBouncesHorizontally( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces when it reaches the ends of its horizontal + /// axis. + func setBouncesHorizontally(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether the scroll view bounces when it reaches the ends of its vertical - /// axis. - func setBouncesVertically( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces when it reaches the ends of its vertical + /// axis. + func setBouncesVertically(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether bouncing always occurs when vertical scrolling reaches the end of - /// the content. - /// - /// If the value of this property is true and `bouncesVertically` is true, the - /// scroll view allows vertical dragging even if the content is smaller than - /// the bounds of the scroll view. - func setAlwaysBounceVertical( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether bouncing always occurs when vertical scrolling reaches the end of + /// the content. + /// + /// If the value of this property is true and `bouncesVertically` is true, the + /// scroll view allows vertical dragging even if the content is smaller than + /// the bounds of the scroll view. + func setAlwaysBounceVertical(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether bouncing always occurs when horizontal scrolling reaches the end - /// of the content view. - /// - /// If the value of this property is true and `bouncesHorizontally` is true, - /// the scroll view allows horizontal dragging even if the content is smaller - /// than the bounds of the scroll view. - func setAlwaysBounceHorizontal( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether bouncing always occurs when horizontal scrolling reaches the end + /// of the content view. + /// + /// If the value of this property is true and `bouncesHorizontally` is true, + /// the scroll view allows horizontal dragging even if the content is smaller + /// than the bounds of the scroll view. + func setAlwaysBounceHorizontal(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif } protocol PigeonApiProtocolUIScrollView { } -final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { +final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIScrollView ///An implementation of [UIView] used to access callback methods @@ -3040,309 +3746,461 @@ final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { return pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollView - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollView? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollView?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let getContentOffsetChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.getContentOffset", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getContentOffsetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - do { - let result = try api.pigeonDelegate.getContentOffset( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getContentOffsetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.getContentOffset", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getContentOffsetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + do { + let result = try api.pigeonDelegate.getContentOffset(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getContentOffsetChannel.setMessageHandler(nil) } + } else { + getContentOffsetChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let scrollByChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.scrollBy", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - scrollByChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let xArg = args[1] as! Double - let yArg = args[2] as! Double - do { - try api.pigeonDelegate.scrollBy( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let scrollByChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.scrollBy", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + scrollByChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let xArg = args[1] as! Double + let yArg = args[2] as! Double + do { + try api.pigeonDelegate.scrollBy(pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - scrollByChannel.setMessageHandler(nil) } + } else { + scrollByChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setContentOffsetChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setContentOffset", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setContentOffsetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let xArg = args[1] as! Double - let yArg = args[2] as! Double - do { - try api.pigeonDelegate.setContentOffset( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setContentOffsetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setContentOffset", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setContentOffsetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let xArg = args[1] as! Double + let yArg = args[2] as! Double + do { + try api.pigeonDelegate.setContentOffset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setContentOffsetChannel.setMessageHandler(nil) } + } else { + setContentOffsetChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let delegateArg: UIScrollViewDelegate? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let delegateArg: UIScrollViewDelegate? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setDelegateChannel.setMessageHandler(nil) } + } else { + setDelegateChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setBouncesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBounces", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBounces( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setBouncesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBounces", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBounces(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setBouncesChannel.setMessageHandler(nil) } + } else { + setBouncesChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setBouncesHorizontallyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesHorizontally", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesHorizontallyChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBouncesHorizontally( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setBouncesHorizontallyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesHorizontally", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesHorizontallyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBouncesHorizontally(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setBouncesHorizontallyChannel.setMessageHandler(nil) } + } else { + setBouncesHorizontallyChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setBouncesVerticallyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesVertically", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesVerticallyChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBouncesVertically( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setBouncesVerticallyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesVertically", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesVerticallyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBouncesVertically(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setBouncesVerticallyChannel.setMessageHandler(nil) } + } else { + setBouncesVerticallyChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setAlwaysBounceVerticalChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceVertical", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAlwaysBounceVerticalChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAlwaysBounceVertical( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAlwaysBounceVerticalChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceVertical", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAlwaysBounceVerticalChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAlwaysBounceVertical(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAlwaysBounceVerticalChannel.setMessageHandler(nil) } + } else { + setAlwaysBounceVerticalChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setAlwaysBounceHorizontalChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceHorizontal", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAlwaysBounceHorizontalChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAlwaysBounceHorizontal( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAlwaysBounceHorizontalChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceHorizontal", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAlwaysBounceHorizontalChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAlwaysBounceHorizontal(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAlwaysBounceHorizontalChannel.setMessageHandler(nil) } + } else { + setAlwaysBounceHorizontalChannel.setMessageHandler(nil) + } #endif } #if !os(macOS) - ///Creates a Dart instance of UIScrollView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: UIScrollView, 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.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(())) - } + ///Creates a Dart instance of UIScrollView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: UIScrollView, 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.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(())) } } } + } #endif } -protocol PigeonApiDelegateWKWebViewConfiguration { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws - -> WKWebViewConfiguration - /// The object that coordinates interactions between your app’s native code - /// and the webpage’s scripts and other content. - func setUserContentController( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, - controller: WKUserContentController) throws - /// The object that coordinates interactions between your app’s native code - /// and the webpage’s scripts and other content. - func getUserContentController( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration - ) throws -> WKUserContentController - /// The object you use to get and set the site’s cookies and to track the - /// cached data objects. - func setWebsiteDataStore( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, - dataStore: WKWebsiteDataStore) throws - /// The object you use to get and set the site’s cookies and to track the - /// cached data objects. - func getWebsiteDataStore( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration - ) throws -> WKWebsiteDataStore - /// The object that manages the preference-related settings for the web view. - func setPreferences( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, - preferences: WKPreferences) throws + +/* +// 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 Foundation +import UIKit + + +/// ProxyApi implementation for `UIScrollView`. +/// +/// 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 ScrollViewProxyAPIDelegate : PigeonApiDelegateUIScrollView { + func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws -> [Double] { + return pigeonInstance.contentOffset + } + + func scrollBy(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws { + pigeonInstance.scrollBy(x: x, y: y) + } + + func setContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws { + pigeonInstance.setContentOffset(x: x, y: y) + } + + func setDelegate(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, delegate: UIScrollViewDelegate?) throws { + pigeonInstance.delegate = delegate: delegate + } + + func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.bounces = value: value + } + + func setBouncesHorizontally(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.bouncesHorizontally = value: value + } + + func setBouncesVertically(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.bouncesVertically = value: value + } + + func setAlwaysBounceVertical(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.alwaysBounceVertical = value: value + } + + func setAlwaysBounceHorizontal(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.alwaysBounceHorizontal = value: value + } + +} +*/ + +/* +// 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 UIKit +import Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ScrollViewProxyAPITests: XCTestCase { + func testGetContentOffset() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = api.pigeonDelegate.getContentOffset(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getContentOffsetCalled) + XCTAssertEqual(value, instance.getContentOffset()) + } + + func testScrollBy() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let x = 1.0 + let y = 1.0 + api.pigeonDelegate.scrollBy(pigeonApi: api, pigeonInstance: instance, x: x, y: y) + + XCTAssertEqual(instance.scrollByArgs, [x, y]) + } + + func testSetContentOffset() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let x = 1.0 + let y = 1.0 + api.pigeonDelegate.setContentOffset(pigeonApi: api, pigeonInstance: instance, x: x, y: y) + + XCTAssertEqual(instance.setContentOffsetArgs, [x, y]) + } + + func testSetDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let delegate = TestScrollViewDelegate + api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setDelegateArgs, [delegate]) + } + + func testSetBounces() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setBounces(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setBouncesArgs, [value]) + } + + func testSetBouncesHorizontally() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setBouncesHorizontally(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setBouncesHorizontallyArgs, [value]) + } + + func testSetBouncesVertically() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setBouncesVertically(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setBouncesVerticallyArgs, [value]) + } + + func testSetAlwaysBounceVertical() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setAlwaysBounceVertical(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setAlwaysBounceVerticalArgs, [value]) + } + + func testSetAlwaysBounceHorizontal() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setAlwaysBounceHorizontal(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setAlwaysBounceHorizontalArgs, [value]) + } + +} +class TestScrollView: UIScrollView { + var getContentOffsetCalled = false + var scrollByArgs: [AnyHashable?]? = nil + var setContentOffsetArgs: [AnyHashable?]? = nil + var setDelegateArgs: [AnyHashable?]? = nil + var setBouncesArgs: [AnyHashable?]? = nil + var setBouncesHorizontallyArgs: [AnyHashable?]? = nil + var setBouncesVerticallyArgs: [AnyHashable?]? = nil + var setAlwaysBounceVerticalArgs: [AnyHashable?]? = nil + var setAlwaysBounceHorizontalArgs: [AnyHashable?]? = nil + + + override func getContentOffset() { + getContentOffsetCalled = true + } + override func scrollBy() { + scrollByArgs = [x, y] + } + override func setContentOffset() { + setContentOffsetArgs = [x, y] + } + override func setDelegate() { + setDelegateArgs = [delegate] + } + override func setBounces() { + setBouncesArgs = [value] + } + override func setBouncesHorizontally() { + setBouncesHorizontallyArgs = [value] + } + override func setBouncesVertically() { + setBouncesVerticallyArgs = [value] + } + override func setAlwaysBounceVertical() { + setAlwaysBounceVerticalArgs = [value] + } + override func setAlwaysBounceHorizontal() { + setAlwaysBounceHorizontalArgs = [value] + } +} +*/ + +protocol PigeonApiDelegateWKWebViewConfiguration { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration + /// The object that coordinates interactions between your app’s native code + /// and the webpage’s scripts and other content. + func setUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, controller: WKUserContentController) throws + /// The object that coordinates interactions between your app’s native code + /// and the webpage’s scripts and other content. + func getUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKUserContentController + /// The object you use to get and set the site’s cookies and to track the + /// cached data objects. + func setWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, dataStore: WKWebsiteDataStore) throws + /// The object you use to get and set the site’s cookies and to track the + /// cached data objects. + func getWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebsiteDataStore /// The object that manages the preference-related settings for the web view. - func getPreferences( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration - ) throws -> WKPreferences + func setPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, preferences: WKPreferences) throws + /// The object that manages the preference-related settings for the web view. + func getPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKPreferences /// A Boolean value that indicates whether HTML5 videos play inline or use the /// native full-screen controller. - func setAllowsInlineMediaPlayback( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) - throws + func setAllowsInlineMediaPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) throws /// A Boolean value that indicates whether the web view limits navigation to /// pages within the app’s domain. - func setLimitsNavigationsToAppBoundDomains( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) - throws + func setLimitsNavigationsToAppBoundDomains(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) throws /// The media types that require a user gesture to begin playing. - func setMediaTypesRequiringUserActionForPlayback( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, - type: AudiovisualMediaType) throws + 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 + func getDefaultWebpagePreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebpagePreferences } protocol PigeonApiProtocolWKWebViewConfiguration { } -final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfiguration { +final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfiguration { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebViewConfiguration ///An implementation of [NSObject] used to access callback methods @@ -3350,34 +4208,25 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKWebViewConfiguration - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebViewConfiguration) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebViewConfiguration? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebViewConfiguration?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3386,18 +4235,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setUserContentControllerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setUserContentController", - binaryMessenger: binaryMessenger, codec: codec) + let setUserContentControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setUserContentController", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setUserContentControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let controllerArg = args[1] as! WKUserContentController do { - try api.pigeonDelegate.setUserContentController( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) + try api.pigeonDelegate.setUserContentController(pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3406,17 +4251,13 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setUserContentControllerChannel.setMessageHandler(nil) } - let getUserContentControllerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getUserContentController", - binaryMessenger: binaryMessenger, codec: codec) + let getUserContentControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getUserContentController", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getUserContentControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getUserContentController( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getUserContentController(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3425,18 +4266,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { getUserContentControllerChannel.setMessageHandler(nil) } - let setWebsiteDataStoreChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setWebsiteDataStore", - binaryMessenger: binaryMessenger, codec: codec) + let setWebsiteDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setWebsiteDataStore", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setWebsiteDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let dataStoreArg = args[1] as! WKWebsiteDataStore do { - try api.pigeonDelegate.setWebsiteDataStore( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataStore: dataStoreArg) + try api.pigeonDelegate.setWebsiteDataStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataStore: dataStoreArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3445,17 +4282,13 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setWebsiteDataStoreChannel.setMessageHandler(nil) } - let getWebsiteDataStoreChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getWebsiteDataStore", - binaryMessenger: binaryMessenger, codec: codec) + let getWebsiteDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getWebsiteDataStore", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getWebsiteDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getWebsiteDataStore( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getWebsiteDataStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3464,17 +4297,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { getWebsiteDataStoreChannel.setMessageHandler(nil) } - let setPreferencesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setPreferences", - binaryMessenger: binaryMessenger, codec: codec) + let setPreferencesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setPreferences", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setPreferencesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let preferencesArg = args[1] as! WKPreferences do { - try api.pigeonDelegate.setPreferences( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, preferences: preferencesArg) + try api.pigeonDelegate.setPreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg, preferences: preferencesArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3483,16 +4313,13 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setPreferencesChannel.setMessageHandler(nil) } - let getPreferencesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getPreferences", - binaryMessenger: binaryMessenger, codec: codec) + let getPreferencesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getPreferences", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getPreferencesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getPreferences( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getPreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3501,18 +4328,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { getPreferencesChannel.setMessageHandler(nil) } - let setAllowsInlineMediaPlaybackChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setAllowsInlineMediaPlayback", - binaryMessenger: binaryMessenger, codec: codec) + let setAllowsInlineMediaPlaybackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setAllowsInlineMediaPlayback", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAllowsInlineMediaPlaybackChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let allowArg = args[1] as! Bool do { - try api.pigeonDelegate.setAllowsInlineMediaPlayback( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + try api.pigeonDelegate.setAllowsInlineMediaPlayback(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3521,18 +4344,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setAllowsInlineMediaPlaybackChannel.setMessageHandler(nil) } - let setLimitsNavigationsToAppBoundDomainsChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains", - binaryMessenger: binaryMessenger, codec: codec) + let setLimitsNavigationsToAppBoundDomainsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLimitsNavigationsToAppBoundDomainsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let limitArg = args[1] as! Bool do { - try api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, limit: limitArg) + try api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains(pigeonApi: api, pigeonInstance: pigeonInstanceArg, limit: limitArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3541,18 +4360,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setLimitsNavigationsToAppBoundDomainsChannel.setMessageHandler(nil) } - let setMediaTypesRequiringUserActionForPlaybackChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback", - binaryMessenger: binaryMessenger, codec: codec) + let setMediaTypesRequiringUserActionForPlaybackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setMediaTypesRequiringUserActionForPlaybackChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let typeArg = args[1] as! AudiovisualMediaType do { - try api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, type: typeArg) + try api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback(pigeonApi: api, pigeonInstance: pigeonInstanceArg, type: typeArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3562,17 +4377,13 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura 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) + 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) + let result = try api.pigeonDelegate.getDefaultWebpagePreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3581,21 +4392,16 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { getDefaultWebpagePreferencesChannel.setMessageHandler(nil) } - } else { + } else { let getDefaultWebpagePreferencesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getDefaultWebpagePreferences", + 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 - ))) + 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) @@ -3604,27 +4410,21 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } ///Creates a Dart instance of WKWebViewConfiguration and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebViewConfiguration, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKWebViewConfiguration, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -3642,33 +4442,264 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKWebViewConfiguration`. +/// +/// 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 WebViewConfigurationProxyAPIDelegate : PigeonApiDelegateWKWebViewConfiguration { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration { + return WKWebViewConfiguration() + } + + func setUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, controller: WKUserContentController) throws { + pigeonInstance.userContentController = controller: controller + } + + func getUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKUserContentController { + return pigeonInstance.userContentController + } + + func setWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, dataStore: WKWebsiteDataStore) throws { + pigeonInstance.websiteDataStore = dataStore: dataStore + } + + func getWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebsiteDataStore { + return pigeonInstance.websiteDataStore + } + + func setPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, preferences: WKPreferences) throws { + pigeonInstance.preferences = preferences: preferences + } + + func getPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKPreferences { + return pigeonInstance.preferences + } + + func setAllowsInlineMediaPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) throws { + pigeonInstance.allowsInlineMediaPlayback = allow: allow + } + + func setLimitsNavigationsToAppBoundDomains(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) throws { + pigeonInstance.limitsNavigationsToAppBoundDomains = limit: limit + } + + func setMediaTypesRequiringUserActionForPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, type: AudiovisualMediaType) throws { + pigeonInstance.mediaTypesRequiringUserActionForPlayback = type: type + } + + func getDefaultWebpagePreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebpagePreferences { + return pigeonInstance.defaultWebpagePreferences + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebViewConfigurationProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testSetUserContentController() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let controller = TestUserContentController + api.pigeonDelegate.setUserContentController(pigeonApi: api, pigeonInstance: instance, controller: controller) + + XCTAssertEqual(instance.setUserContentControllerArgs, [controller]) + } + + func testGetUserContentController() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let value = api.pigeonDelegate.getUserContentController(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getUserContentControllerCalled) + XCTAssertEqual(value, instance.getUserContentController()) + } + + func testSetWebsiteDataStore() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let dataStore = TestWebsiteDataStore + api.pigeonDelegate.setWebsiteDataStore(pigeonApi: api, pigeonInstance: instance, dataStore: dataStore) + + XCTAssertEqual(instance.setWebsiteDataStoreArgs, [dataStore]) + } + + func testGetWebsiteDataStore() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let value = api.pigeonDelegate.getWebsiteDataStore(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getWebsiteDataStoreCalled) + XCTAssertEqual(value, instance.getWebsiteDataStore()) + } + + func testSetPreferences() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let preferences = TestPreferences + api.pigeonDelegate.setPreferences(pigeonApi: api, pigeonInstance: instance, preferences: preferences) + + XCTAssertEqual(instance.setPreferencesArgs, [preferences]) + } + + func testGetPreferences() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let value = api.pigeonDelegate.getPreferences(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getPreferencesCalled) + XCTAssertEqual(value, instance.getPreferences()) + } + + func testSetAllowsInlineMediaPlayback() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let allow = true + api.pigeonDelegate.setAllowsInlineMediaPlayback(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsInlineMediaPlaybackArgs, [allow]) + } + + func testSetLimitsNavigationsToAppBoundDomains() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let limit = true + api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains(pigeonApi: api, pigeonInstance: instance, limit: limit) + + XCTAssertEqual(instance.setLimitsNavigationsToAppBoundDomainsArgs, [limit]) + } + + func testSetMediaTypesRequiringUserActionForPlayback() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let type = .none + api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback(pigeonApi: api, pigeonInstance: instance, type: type) + + XCTAssertEqual(instance.setMediaTypesRequiringUserActionForPlaybackArgs, [type]) + } + + func testGetDefaultWebpagePreferences() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let value = api.pigeonDelegate.getDefaultWebpagePreferences(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getDefaultWebpagePreferencesCalled) + XCTAssertEqual(value, instance.getDefaultWebpagePreferences()) + } + +} +class TestWebViewConfiguration: WKWebViewConfiguration { + var setUserContentControllerArgs: [AnyHashable?]? = nil + var getUserContentControllerCalled = false + var setWebsiteDataStoreArgs: [AnyHashable?]? = nil + var getWebsiteDataStoreCalled = false + var setPreferencesArgs: [AnyHashable?]? = nil + var getPreferencesCalled = false + var setAllowsInlineMediaPlaybackArgs: [AnyHashable?]? = nil + var setLimitsNavigationsToAppBoundDomainsArgs: [AnyHashable?]? = nil + var setMediaTypesRequiringUserActionForPlaybackArgs: [AnyHashable?]? = nil + var getDefaultWebpagePreferencesCalled = false + + + override func setUserContentController() { + setUserContentControllerArgs = [controller] + } + override func getUserContentController() { + getUserContentControllerCalled = true + } + override func setWebsiteDataStore() { + setWebsiteDataStoreArgs = [dataStore] + } + override func getWebsiteDataStore() { + getWebsiteDataStoreCalled = true + } + override func setPreferences() { + setPreferencesArgs = [preferences] + } + override func getPreferences() { + getPreferencesCalled = true + } + override func setAllowsInlineMediaPlayback() { + setAllowsInlineMediaPlaybackArgs = [allow] + } + override func setLimitsNavigationsToAppBoundDomains() { + setLimitsNavigationsToAppBoundDomainsArgs = [limit] + } + override func setMediaTypesRequiringUserActionForPlayback() { + setMediaTypesRequiringUserActionForPlaybackArgs = [type] + } + override func getDefaultWebpagePreferences() { + getDefaultWebpagePreferencesCalled = true + } +} +*/ + protocol PigeonApiDelegateWKUserContentController { /// Installs a message handler that you can call from your JavaScript code. - func addScriptMessageHandler( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, - handler: WKScriptMessageHandler, name: String) throws + func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws /// Uninstalls the custom message handler with the specified name from your /// JavaScript code. - func removeScriptMessageHandler( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, - name: String) throws + func removeScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, name: String) throws /// Uninstalls all custom message handlers associated with the user content /// controller. - func removeAllScriptMessageHandlers( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws + func removeAllScriptMessageHandlers(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws /// Injects the specified script into the webpage’s content. - func addUserScript( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, - userScript: WKUserScript) throws + func addUserScript(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, userScript: WKUserScript) throws /// Removes all user scripts from the web view. - func removeAllUserScripts( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws + func removeAllUserScripts(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws } protocol PigeonApiProtocolWKUserContentController { } -final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentController { +final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentController { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUserContentController ///An implementation of [NSObject] used to access callback methods @@ -3676,26 +4707,17 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKUserContentController - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserContentController) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserContentController? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserContentController?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let addScriptMessageHandlerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addScriptMessageHandler", - binaryMessenger: binaryMessenger, codec: codec) + let addScriptMessageHandlerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addScriptMessageHandler", binaryMessenger: binaryMessenger, codec: codec) if let api = api { addScriptMessageHandlerChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3703,8 +4725,7 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont let handlerArg = args[1] as! WKScriptMessageHandler let nameArg = args[2] as! String do { - try api.pigeonDelegate.addScriptMessageHandler( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, handler: handlerArg, name: nameArg) + try api.pigeonDelegate.addScriptMessageHandler(pigeonApi: api, pigeonInstance: pigeonInstanceArg, handler: handlerArg, name: nameArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3713,18 +4734,14 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { addScriptMessageHandlerChannel.setMessageHandler(nil) } - let removeScriptMessageHandlerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeScriptMessageHandler", - binaryMessenger: binaryMessenger, codec: codec) + let removeScriptMessageHandlerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeScriptMessageHandler", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeScriptMessageHandlerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController let nameArg = args[1] as! String do { - try api.pigeonDelegate.removeScriptMessageHandler( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, name: nameArg) + try api.pigeonDelegate.removeScriptMessageHandler(pigeonApi: api, pigeonInstance: pigeonInstanceArg, name: nameArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3733,17 +4750,13 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { removeScriptMessageHandlerChannel.setMessageHandler(nil) } - let removeAllScriptMessageHandlersChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllScriptMessageHandlers", - binaryMessenger: binaryMessenger, codec: codec) + let removeAllScriptMessageHandlersChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllScriptMessageHandlers", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeAllScriptMessageHandlersChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController do { - try api.pigeonDelegate.removeAllScriptMessageHandlers( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.removeAllScriptMessageHandlers(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3752,17 +4765,14 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { removeAllScriptMessageHandlersChannel.setMessageHandler(nil) } - let addUserScriptChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addUserScript", - binaryMessenger: binaryMessenger, codec: codec) + let addUserScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addUserScript", binaryMessenger: binaryMessenger, codec: codec) if let api = api { addUserScriptChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController let userScriptArg = args[1] as! WKUserScript do { - try api.pigeonDelegate.addUserScript( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, userScript: userScriptArg) + try api.pigeonDelegate.addUserScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userScript: userScriptArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3771,17 +4781,13 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { addUserScriptChannel.setMessageHandler(nil) } - let removeAllUserScriptsChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllUserScripts", - binaryMessenger: binaryMessenger, codec: codec) + let removeAllUserScriptsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllUserScripts", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeAllUserScriptsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController do { - try api.pigeonDelegate.removeAllUserScripts( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.removeAllUserScripts(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3793,27 +4799,21 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } ///Creates a Dart instance of WKUserContentController and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKUserContentController, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKUserContentController, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -3831,80 +4831,197 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } } } -protocol PigeonApiDelegateWKPreferences { - /// A Boolean value that indicates whether JavaScript is enabled. - func setJavaScriptEnabled( - pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws -} -protocol PigeonApiProtocolWKPreferences { -} +/* +// 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. -final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { - unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateWKPreferences - ///An implementation of [NSObject] used to access callback methods - var pigeonApiNSObject: PigeonApiNSObject { - return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) +import Foundation +import WebKit + + +/// ProxyApi implementation for `WKUserContentController`. +/// +/// 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 UserContentControllerProxyAPIDelegate : PigeonApiDelegateWKUserContentController { + func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws { + pigeonInstance.addScriptMessageHandler(handler: handler, name: name) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKPreferences - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate + func removeScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, name: String) throws { + pigeonInstance.removeScriptMessageHandler(name: name) } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKPreferences? - ) { - let codec: FlutterStandardMessageCodec = - api != nil - ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) - : FlutterStandardMessageCodec.sharedInstance() - let setJavaScriptEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.setJavaScriptEnabled", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setJavaScriptEnabledChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKPreferences - let enabledArg = args[1] as! Bool - do { - try api.pigeonDelegate.setJavaScriptEnabled( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, enabled: enabledArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - setJavaScriptEnabledChannel.setMessageHandler(nil) - } + + func removeAllScriptMessageHandlers(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws { + pigeonInstance.removeAllScriptMessageHandlers() } - ///Creates a Dart instance of WKPreferences and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKPreferences, 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) + func addUserScript(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, userScript: WKUserScript) throws { + pigeonInstance.addUserScript(userScript: userScript) + } + + func removeAllUserScripts(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws { + pigeonInstance.removeAllUserScripts() + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class UserContentControllerProxyAPITests: XCTestCase { + func testAddScriptMessageHandler() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + let handler = TestScriptMessageHandler + let name = "myString" + api.pigeonDelegate.addScriptMessageHandler(pigeonApi: api, pigeonInstance: instance, handler: handler, name: name) + + XCTAssertEqual(instance.addScriptMessageHandlerArgs, [handler, name]) + } + + func testRemoveScriptMessageHandler() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + let name = "myString" + api.pigeonDelegate.removeScriptMessageHandler(pigeonApi: api, pigeonInstance: instance, name: name) + + XCTAssertEqual(instance.removeScriptMessageHandlerArgs, [name]) + } + + func testRemoveAllScriptMessageHandlers() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + api.pigeonDelegate.removeAllScriptMessageHandlers(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.removeAllScriptMessageHandlersCalled) + } + + func testAddUserScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + let userScript = TestUserScript + api.pigeonDelegate.addUserScript(pigeonApi: api, pigeonInstance: instance, userScript: userScript) + + XCTAssertEqual(instance.addUserScriptArgs, [userScript]) + } + + func testRemoveAllUserScripts() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + api.pigeonDelegate.removeAllUserScripts(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.removeAllUserScriptsCalled) + } + +} +class TestUserContentController: WKUserContentController { + var addScriptMessageHandlerArgs: [AnyHashable?]? = nil + var removeScriptMessageHandlerArgs: [AnyHashable?]? = nil + var removeAllScriptMessageHandlersCalled = false + var addUserScriptArgs: [AnyHashable?]? = nil + var removeAllUserScriptsCalled = false + + + override func addScriptMessageHandler() { + addScriptMessageHandlerArgs = [handler, name] + } + override func removeScriptMessageHandler() { + removeScriptMessageHandlerArgs = [name] + } + override func removeAllScriptMessageHandlers() { + removeAllScriptMessageHandlersCalled = true + } + override func addUserScript() { + addUserScriptArgs = [userScript] + } + override func removeAllUserScripts() { + removeAllUserScriptsCalled = true + } +} +*/ + +protocol PigeonApiDelegateWKPreferences { + /// A Boolean value that indicates whether JavaScript is enabled. + func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws +} + +protocol PigeonApiProtocolWKPreferences { +} + +final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { + unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar + let pigeonDelegate: PigeonApiDelegateWKPreferences + ///An implementation of [NSObject] used to access callback methods + var pigeonApiNSObject: PigeonApiNSObject { + return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) + } + + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKPreferences) { + self.pigeonRegistrar = pigeonRegistrar + self.pigeonDelegate = delegate + } + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKPreferences?) { + let codec: FlutterStandardMessageCodec = + api != nil + ? FlutterStandardMessageCodec( + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + : FlutterStandardMessageCodec.sharedInstance() + let setJavaScriptEnabledChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.setJavaScriptEnabled", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setJavaScriptEnabledChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKPreferences + let enabledArg = args[1] as! Bool + do { + try api.pigeonDelegate.setJavaScriptEnabled(pigeonApi: api, pigeonInstance: pigeonInstanceArg, enabled: enabledArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + setJavaScriptEnabledChannel.setMessageHandler(nil) + } + } + + ///Creates a Dart instance of WKPreferences and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKPreferences, 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.WKPreferences.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: 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))) @@ -3922,20 +5039,72 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKPreferences`. +/// +/// 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 PreferencesProxyAPIDelegate : PigeonApiDelegateWKPreferences { + func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws { + pigeonInstance.javaScriptEnabled = enabled: enabled + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class PreferencesProxyAPITests: XCTestCase { + func testSetJavaScriptEnabled() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKPreferences(registrar) + + let instance = TestPreferences() + let enabled = true + api.pigeonDelegate.setJavaScriptEnabled(pigeonApi: api, pigeonInstance: instance, enabled: enabled) + + XCTAssertEqual(instance.setJavaScriptEnabledArgs, [enabled]) + } + +} +class TestPreferences: WKPreferences { + var setJavaScriptEnabledArgs: [AnyHashable?]? = nil + + + override func setJavaScriptEnabled() { + setJavaScriptEnabledArgs = [enabled] + } +} +*/ + protocol PigeonApiDelegateWKScriptMessageHandler { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws - -> WKScriptMessageHandler + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler } protocol PigeonApiProtocolWKScriptMessageHandler { /// Tells the handler that a webpage sent a script message. - func didReceiveScriptMessage( - pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, - controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, - completion: @escaping (Result) -> Void) + func didReceiveScriptMessage(pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, completion: @escaping (Result) -> Void) } -final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHandler { +final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHandler { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKScriptMessageHandler ///An implementation of [NSObject] used to access callback methods @@ -3943,34 +5112,25 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKScriptMessageHandler - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKScriptMessageHandler) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKScriptMessageHandler? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKScriptMessageHandler?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3982,34 +5142,25 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan } ///Creates a Dart instance of WKScriptMessageHandler and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKScriptMessageHandler, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKScriptMessageHandler, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + message: "Error: Attempting to create a new Dart instance of WKScriptMessageHandler, but the class has a nonnull callback method.", details: ""))) } } /// Tells the handler that a webpage sent a script message. - func didReceiveScriptMessage( - pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, - controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, - completion: @escaping (Result) -> Void - ) { + func didReceiveScriptMessage(pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4020,10 +5171,8 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.didReceiveScriptMessage" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.didReceiveScriptMessage" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, controllerArg, messageArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4041,45 +5190,102 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan } } + +/* +// 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 Foundation +import WebKit + +/// Implementation of `WKScriptMessageHandler` that calls to Dart in callback methods. +class ScriptMessageHandlerImpl: WKScriptMessageHandler { + let api: PigeonApiProtocolWKScriptMessageHandler + + init(api: PigeonApiProtocolWKScriptMessageHandler) { + self.api = api + } + + func fixMe() { + api.didReceiveScriptMessage(pigeonInstance: self, controller: controller, message: message) { _ in } + } +} + +/// ProxyApi implementation for `WKScriptMessageHandler`. +/// +/// 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 ScriptMessageHandlerProxyAPIDelegate : PigeonApiDelegateWKScriptMessageHandler { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler { + return WKScriptMessageHandlerImpl(api: pigeonApi) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ScriptMessageHandlerProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKScriptMessageHandler(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testDidReceiveScriptMessage() { + let api = TestScriptMessageHandlerApi() + let instance = ScriptMessageHandlerImpl(api: api) + let controller = TestUserContentController + let message = TestScriptMessage + instance.didReceiveScriptMessage(controller: controller, message: message) + + XCTAssertEqual(api.didReceiveScriptMessageArgs, [controller, message]) + } + +} +class TestScriptMessageHandlerApi: PigeonApiProtocolWKScriptMessageHandler { + var didReceiveScriptMessageArgs: [AnyHashable?]? = nil + + func didReceiveScriptMessage(controller: WKUserContentController, message: WKScriptMessage) throws { + didReceiveScriptMessageArgs = [controllerArg, messageArg] + } +} +*/ + protocol PigeonApiDelegateWKNavigationDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws - -> WKNavigationDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate } protocol PigeonApiProtocolWKNavigationDelegate { /// Tells the delegate that navigation is complete. - func didFinishNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - url urlArg: String?, completion: @escaping (Result) -> Void) + func didFinishNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) /// Tells the delegate that navigation from the main frame has started. - func didStartProvisionalNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - url urlArg: String?, completion: @escaping (Result) -> Void) + func didStartProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) /// Asks the delegate for permission to navigate to new content based on the /// specified action information. - func decidePolicyForNavigationAction( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - navigationAction navigationActionArg: WKNavigationAction, - completion: @escaping (Result) -> Void) + func decidePolicyForNavigationAction(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. - func decidePolicyForNavigationResponse( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - navigationResponse navigationResponseArg: WKNavigationResponse, - completion: @escaping (Result) -> Void) + func decidePolicyForNavigationResponse(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationResponse navigationResponseArg: WKNavigationResponse, completion: @escaping (Result) -> Void) /// Tells the delegate that an error occurred during navigation. - func didFailNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - error errorArg: NSError, completion: @escaping (Result) -> Void) + func didFailNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) /// Tells the delegate that an error occurred during the early navigation /// process. - func didFailProvisionalNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - error errorArg: NSError, completion: @escaping (Result) -> Void) + func didFailProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) /// Tells the delegate that the web view’s content process was terminated. - func webViewWebContentProcessDidTerminate( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - completion: @escaping (Result) -> Void) + func webViewWebContentProcessDidTerminate(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, completion: @escaping (Result) -> Void) /// Asks the delegate to respond to an authentication challenge. /// /// This return value expects a List with: @@ -4091,13 +5297,10 @@ protocol PigeonApiProtocolWKNavigationDelegate { /// "password": "", /// "persistence": , /// ] - func didReceiveAuthenticationChallenge( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - challenge challengeArg: URLAuthenticationChallenge, - completion: @escaping (Result<[Any?], PigeonError>) -> Void) + func didReceiveAuthenticationChallenge(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping (Result<[Any?], PigeonError>) -> Void) } -final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate { +final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationDelegate ///An implementation of [NSObject] used to access callback methods @@ -4105,34 +5308,25 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKNavigationDelegate - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKNavigationDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKNavigationDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -4144,32 +5338,25 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } ///Creates a Dart instance of WKNavigationDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKNavigationDelegate, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKNavigationDelegate, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + 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. - func didFinishNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - url urlArg: String?, completion: @escaping (Result) -> Void - ) { + func didFinishNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4180,10 +5367,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFinishNavigation" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFinishNavigation" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, urlArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4201,10 +5386,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } /// Tells the delegate that navigation from the main frame has started. - func didStartProvisionalNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - url urlArg: String?, completion: @escaping (Result) -> Void - ) { + func didStartProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4215,10 +5397,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didStartProvisionalNavigation" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didStartProvisionalNavigation" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, urlArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4237,11 +5417,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate /// Asks the delegate for permission to navigate to new content based on the /// specified action information. - func decidePolicyForNavigationAction( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - navigationAction navigationActionArg: WKNavigationAction, - completion: @escaping (Result) -> Void - ) { + func decidePolicyForNavigationAction(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4252,12 +5428,9 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, navigationActionArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, navigationActionArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -4268,11 +5441,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! NavigationActionPolicy completion(.success(result)) @@ -4282,11 +5451,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. - func decidePolicyForNavigationResponse( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - navigationResponse navigationResponseArg: WKNavigationResponse, - completion: @escaping (Result) -> Void - ) { + func decidePolicyForNavigationResponse(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationResponse navigationResponseArg: WKNavigationResponse, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4297,12 +5462,9 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, navigationResponseArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, navigationResponseArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -4313,11 +5475,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! NavigationResponsePolicy completion(.success(result)) @@ -4326,10 +5484,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } /// Tells the delegate that an error occurred during navigation. - func didFailNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - error errorArg: NSError, completion: @escaping (Result) -> Void - ) { + func didFailNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4340,10 +5495,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailNavigation" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailNavigation" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4362,10 +5515,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate /// Tells the delegate that an error occurred during the early navigation /// process. - func didFailProvisionalNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - error errorArg: NSError, completion: @escaping (Result) -> Void - ) { + func didFailProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4376,10 +5526,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailProvisionalNavigation" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailProvisionalNavigation" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4397,10 +5545,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } /// Tells the delegate that the web view’s content process was terminated. - func webViewWebContentProcessDidTerminate( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - completion: @escaping (Result) -> Void - ) { + func webViewWebContentProcessDidTerminate(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4411,10 +5556,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.webViewWebContentProcessDidTerminate" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.webViewWebContentProcessDidTerminate" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4442,11 +5585,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate /// "password": "", /// "persistence": , /// ] - func didReceiveAuthenticationChallenge( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - challenge challengeArg: URLAuthenticationChallenge, - completion: @escaping (Result<[Any?], PigeonError>) -> Void - ) { + func didReceiveAuthenticationChallenge(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping (Result<[Any?], PigeonError>) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4457,10 +5596,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, challengeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4472,11 +5609,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -4485,56 +5618,244 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } } + +/* +// 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 Foundation +import WebKit + +/// Implementation of `WKNavigationDelegate` that calls to Dart in callback methods. +class NavigationDelegateImpl: WKNavigationDelegate { + let api: PigeonApiProtocolWKNavigationDelegate + + init(api: PigeonApiProtocolWKNavigationDelegate) { + self.api = api + } + + func fixMe() { + api.didFinishNavigation(pigeonInstance: self, webView: webView, url: url) { _ in } + } + + func fixMe() { + api.didStartProvisionalNavigation(pigeonInstance: self, webView: webView, url: url) { _ in } + } + + func fixMe() { + api.decidePolicyForNavigationAction(pigeonInstance: self, webView: webView, navigationAction: navigationAction) { _ in } + } + + func fixMe() { + api.decidePolicyForNavigationResponse(pigeonInstance: self, webView: webView, navigationResponse: navigationResponse) { _ in } + } + + func fixMe() { + api.didFailNavigation(pigeonInstance: self, webView: webView, error: error) { _ in } + } + + func fixMe() { + api.didFailProvisionalNavigation(pigeonInstance: self, webView: webView, error: error) { _ in } + } + + func fixMe() { + api.webViewWebContentProcessDidTerminate(pigeonInstance: self, webView: webView) { _ in } + } + + func fixMe() { + api.didReceiveAuthenticationChallenge(pigeonInstance: self, webView: webView, challenge: challenge) { _ in } + } +} + +/// ProxyApi implementation for `WKNavigationDelegate`. +/// +/// 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 NavigationDelegateProxyAPIDelegate : PigeonApiDelegateWKNavigationDelegate { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate { + return WKNavigationDelegateImpl(api: pigeonApi) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class NavigationDelegateProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationDelegate(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testDidFinishNavigation() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let url = "myString" + instance.didFinishNavigation(webView: webView, url: url) + + XCTAssertEqual(api.didFinishNavigationArgs, [webView, url]) + } + + func testDidStartProvisionalNavigation() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let url = "myString" + instance.didStartProvisionalNavigation(webView: webView, url: url) + + XCTAssertEqual(api.didStartProvisionalNavigationArgs, [webView, url]) + } + + func testDecidePolicyForNavigationAction() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let navigationAction = TestNavigationAction + instance.decidePolicyForNavigationAction(webView: webView, navigationAction: navigationAction) + + XCTAssertEqual(api.decidePolicyForNavigationActionArgs, [webView, navigationAction]) + } + + func testDecidePolicyForNavigationResponse() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let navigationResponse = TestNavigationResponse + instance.decidePolicyForNavigationResponse(webView: webView, navigationResponse: navigationResponse) + + XCTAssertEqual(api.decidePolicyForNavigationResponseArgs, [webView, navigationResponse]) + } + + func testDidFailNavigation() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let error = TestError + instance.didFailNavigation(webView: webView, error: error) + + XCTAssertEqual(api.didFailNavigationArgs, [webView, error]) + } + + func testDidFailProvisionalNavigation() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let error = TestError + instance.didFailProvisionalNavigation(webView: webView, error: error) + + XCTAssertEqual(api.didFailProvisionalNavigationArgs, [webView, error]) + } + + func testWebViewWebContentProcessDidTerminate() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + instance.webViewWebContentProcessDidTerminate(webView: webView) + + XCTAssertEqual(api.webViewWebContentProcessDidTerminateArgs, [webView]) + } + + func testDidReceiveAuthenticationChallenge() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let challenge = TestURLAuthenticationChallenge + instance.didReceiveAuthenticationChallenge(webView: webView, challenge: challenge) + + XCTAssertEqual(api.didReceiveAuthenticationChallengeArgs, [webView, challenge]) + } + +} +class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate { + var didFinishNavigationArgs: [AnyHashable?]? = nil + var didStartProvisionalNavigationArgs: [AnyHashable?]? = nil + var decidePolicyForNavigationActionArgs: [AnyHashable?]? = nil + var decidePolicyForNavigationResponseArgs: [AnyHashable?]? = nil + var didFailNavigationArgs: [AnyHashable?]? = nil + var didFailProvisionalNavigationArgs: [AnyHashable?]? = nil + var webViewWebContentProcessDidTerminateArgs: [AnyHashable?]? = nil + var didReceiveAuthenticationChallengeArgs: [AnyHashable?]? = nil + + func didFinishNavigation(webView: WKWebView, url: String?) throws { + didFinishNavigationArgs = [webViewArg, urlArg] + } + func didStartProvisionalNavigation(webView: WKWebView, url: String?) throws { + didStartProvisionalNavigationArgs = [webViewArg, urlArg] + } + func decidePolicyForNavigationAction(webView: WKWebView, navigationAction: WKNavigationAction) throws -> NavigationActionPolicy { + decidePolicyForNavigationActionArgs = [webViewArg, navigationActionArg] + } + func decidePolicyForNavigationResponse(webView: WKWebView, navigationResponse: WKNavigationResponse) throws -> NavigationResponsePolicy { + decidePolicyForNavigationResponseArgs = [webViewArg, navigationResponseArg] + } + func didFailNavigation(webView: WKWebView, error: NSError) throws { + didFailNavigationArgs = [webViewArg, errorArg] + } + func didFailProvisionalNavigation(webView: WKWebView, error: NSError) throws { + didFailProvisionalNavigationArgs = [webViewArg, errorArg] + } + func webViewWebContentProcessDidTerminate(webView: WKWebView) throws { + webViewWebContentProcessDidTerminateArgs = [webViewArg] + } + func didReceiveAuthenticationChallenge(webView: WKWebView, challenge: URLAuthenticationChallenge) throws -> [Any?] { + didReceiveAuthenticationChallengeArgs = [webViewArg, challengeArg] + } +} +*/ + protocol PigeonApiDelegateNSObject { func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject /// Registers the observer object to receive KVO notifications for the key /// path relative to the object receiving this message. - func addObserver( - pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, - options: [KeyValueObservingOptions]) throws + func addObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, options: [KeyValueObservingOptions]) throws /// Stops the observer object from receiving change notifications for the /// property specified by the key path relative to the object receiving this /// message. - func removeObserver( - pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) - throws + func removeObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) throws } protocol PigeonApiProtocolNSObject { /// Informs the observing object when the value at the specified key path /// relative to the observed object has changed. - func observeValue( - pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, - object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, - completion: @escaping (Result) -> Void) + func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) } -final class PigeonApiNSObject: PigeonApiProtocolNSObject { +final class PigeonApiNSObject: PigeonApiProtocolNSObject { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSObject init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSObject) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSObject?) - { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSObject?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -4543,9 +5864,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let addObserverChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.addObserver", - binaryMessenger: binaryMessenger, codec: codec) + let addObserverChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.addObserver", binaryMessenger: binaryMessenger, codec: codec) if let api = api { addObserverChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -4554,9 +5873,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { let keyPathArg = args[2] as! String let optionsArg = args[3] as! [KeyValueObservingOptions] do { - try api.pigeonDelegate.addObserver( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, - keyPath: keyPathArg, options: optionsArg) + try api.pigeonDelegate.addObserver(pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, keyPath: keyPathArg, options: optionsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -4565,9 +5882,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } else { addObserverChannel.setMessageHandler(nil) } - let removeObserverChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.removeObserver", - binaryMessenger: binaryMessenger, codec: codec) + let removeObserverChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.removeObserver", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeObserverChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -4575,9 +5890,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { let observerArg = args[1] as! NSObject let keyPathArg = args[2] as! String do { - try api.pigeonDelegate.removeObserver( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, - keyPath: keyPathArg) + try api.pigeonDelegate.removeObserver(pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, keyPath: keyPathArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -4589,26 +5902,21 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } ///Creates a Dart instance of NSObject and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: NSObject, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: NSObject, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -4627,11 +5935,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } /// Informs the observing object when the value at the specified key path /// relative to the observed object has changed. - func observeValue( - pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, - object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, - completion: @escaping (Result) -> Void - ) { + func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4643,10 +5947,8 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.observeValue" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] as [Any?]) { - response in + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -4663,135 +5965,233 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } } -protocol PigeonApiDelegateUIViewWKWebView { + +/* +// 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 Foundation + + +/// Implementation of `NSObject` that calls to Dart in callback methods. +class ObjectImpl: NSObject { + let api: PigeonApiProtocolNSObject + + init(api: PigeonApiProtocolNSObject) { + self.api = api + } + + func fixMe() { + api.observeValue(pigeonInstance: self, keyPath: keyPath, object: object, change: change) { _ in } + } +} + +/// ProxyApi implementation for `NSObject`. +/// +/// 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 ObjectProxyAPIDelegate : PigeonApiDelegateNSObject { + func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject { + return NSObjectImpl(api: pigeonApi) + } + + func addObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, options: [KeyValueObservingOptions]) throws { + pigeonInstance.addObserver(observer: observer, keyPath: keyPath, options: options) + } + + func removeObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) throws { + pigeonInstance.removeObserver(observer: observer, keyPath: keyPath) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ObjectProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSObject(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testAddObserver() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSObject(registrar) + + let instance = TestObject() + let observer = TestObject + let keyPath = "myString" + let options = [.newValue] + api.pigeonDelegate.addObserver(pigeonApi: api, pigeonInstance: instance, observer: observer, keyPath: keyPath, options: options) + + XCTAssertEqual(instance.addObserverArgs, [observer, keyPath, options]) + } + + func testRemoveObserver() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSObject(registrar) + + let instance = TestObject() + let observer = TestObject + let keyPath = "myString" + api.pigeonDelegate.removeObserver(pigeonApi: api, pigeonInstance: instance, observer: observer, keyPath: keyPath) + + XCTAssertEqual(instance.removeObserverArgs, [observer, keyPath]) + } + + func testObserveValue() { + let api = TestObjectApi() + let instance = ObjectImpl(api: api) + let keyPath = "myString" + let object = TestObject + let change = [.indexes: -1] + instance.observeValue(keyPath: keyPath, object: object, change: change) + + XCTAssertEqual(api.observeValueArgs, [keyPath, object, change]) + } + +} +class TestObject: NSObject { + var addObserverArgs: [AnyHashable?]? = nil + var removeObserverArgs: [AnyHashable?]? = nil + + + override func addObserver() { + addObserverArgs = [observer, keyPath, options] + } + override func removeObserver() { + removeObserverArgs = [observer, keyPath] + } +} +class TestObjectApi: PigeonApiProtocolNSObject { + var observeValueArgs: [AnyHashable?]? = nil + + func observeValue(keyPath: String?, object: NSObject?, change: [KeyValueChangeKey: Any?]?) throws { + observeValueArgs = [keyPathArg, objectArg, changeArg] + } +} +*/ + +protocol PigeonApiDelegateUIViewWKWebView { #if !os(macOS) - func pigeonDefaultConstructor( - pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration - ) throws -> WKWebView + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView #endif #if !os(macOS) - /// The object that contains the configuration details for the web view. - func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws - -> WKWebViewConfiguration + /// The object that contains the configuration details for the web view. + func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> WKWebViewConfiguration #endif #if !os(macOS) - /// The scroll view associated with the web view. - func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws - -> UIScrollView + /// The scroll view associated with the web view. + func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> UIScrollView #endif #if !os(macOS) - /// The object you use to integrate custom user interface elements, such as - /// contextual menus or panels, into web view interactions. - func setUIDelegate( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws + /// The object you use to integrate custom user interface elements, such as + /// contextual menus or panels, into web view interactions. + func setUIDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws #endif #if !os(macOS) - /// The object you use to manage navigation behavior for the web view. - func setNavigationDelegate( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate - ) throws + /// The object you use to manage navigation behavior for the web view. + func setNavigationDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws #endif #if !os(macOS) - /// The URL for the current webpage. - func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The URL for the current webpage. + func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// An estimate of what fraction of the current navigation has been loaded. - func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws - -> Double + /// An estimate of what fraction of the current navigation has been loaded. + func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Double #endif #if !os(macOS) - /// Loads the web content that the specified URL request object references and - /// navigates to that content. - func load( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) - throws + /// Loads the web content that the specified URL request object references and + /// navigates to that content. + func load(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws #endif #if !os(macOS) - /// Loads the contents of the specified HTML string and navigates to it. - func loadHtmlString( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, - baseUrl: String?) throws + /// Loads the contents of the specified HTML string and navigates to it. + func loadHtmlString(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws #endif #if !os(macOS) - /// Loads the web content from the specified file and navigates to it. - func loadFileUrl( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, - readAccessUrl: String) throws + /// Loads the web content from the specified file and navigates to it. + func loadFileUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws #endif #if !os(macOS) - /// Convenience method to load a Flutter asset. - func loadFlutterAsset( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws + /// Convenience method to load a Flutter asset. + func loadFlutterAsset(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws #endif #if !os(macOS) - /// A Boolean value that indicates whether there is a valid back item in the - /// back-forward list. - func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid back item in the + /// back-forward list. + func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(macOS) - /// A Boolean value that indicates whether there is a valid forward item in - /// the back-forward list. - func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid forward item in + /// the back-forward list. + func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(macOS) - /// Navigates to the back item in the back-forward list. - func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the back item in the back-forward list. + func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// Navigates to the forward item in the back-forward list. - func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the forward item in the back-forward list. + func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// Reloads the current webpage. - func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Reloads the current webpage. + func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// The page title. - func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The page title. + func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// A Boolean value that indicates whether horizontal swipe gestures trigger - /// backward and forward page navigation. - func setAllowsBackForwardNavigationGestures( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// A Boolean value that indicates whether horizontal swipe gestures trigger + /// backward and forward page navigation. + func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif #if !os(macOS) - /// The custom user agent string. - func setCustomUserAgent( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws + /// The custom user agent string. + func setCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws #endif #if !os(macOS) - /// Evaluates the specified JavaScript string. - func evaluateJavaScript( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, - completion: @escaping (Result) -> Void) + /// Evaluates the specified JavaScript string. + func evaluateJavaScript(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) #endif #if !os(macOS) - /// A Boolean value that indicates whether you can inspect the view with - /// Safari Web Inspector. - func setInspectable( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws + /// A Boolean value that indicates whether you can inspect the view with + /// Safari Web Inspector. + func setInspectable(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws #endif #if !os(macOS) - /// The custom user agent string. - func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws - -> String? + /// The custom user agent string. + func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// Whether to allow previews for link destinations and detected data such as - /// addresses and phone numbers. - /// - /// Defaults to true. - func setAllowsLinkPreview( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif } protocol PigeonApiProtocolUIViewWKWebView { } -final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { +final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIViewWKWebView ///An implementation of [UIView] used to access callback methods @@ -4804,673 +6204,1035 @@ final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiWKWebView(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateUIViewWKWebView - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIViewWKWebView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewWKWebView? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewWKWebView?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let initialConfigurationArg = args[1] as! WKWebViewConfiguration - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, initialConfiguration: initialConfigurationArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + let initialConfigurationArg = args[1] as! WKWebViewConfiguration + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: initialConfigurationArg), +withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let configurationChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.configuration", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - configurationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.configuration( - pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let configurationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.configuration", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + configurationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - configurationChannel.setMessageHandler(nil) } + } else { + configurationChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let scrollViewChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.scrollView", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - scrollViewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let scrollViewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.scrollView", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + scrollViewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - scrollViewChannel.setMessageHandler(nil) } + } else { + scrollViewChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setUIDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setUIDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setUIDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKUIDelegate - do { - try api.pigeonDelegate.setUIDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setUIDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setUIDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setUIDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKUIDelegate + do { + try api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setUIDelegateChannel.setMessageHandler(nil) } + } else { + setUIDelegateChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setNavigationDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setNavigationDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setNavigationDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKNavigationDelegate - do { - try api.pigeonDelegate.setNavigationDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setNavigationDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setNavigationDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setNavigationDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKNavigationDelegate + do { + try api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setNavigationDelegateChannel.setMessageHandler(nil) } + } else { + setNavigationDelegateChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let getUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getUrl", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getUrlChannel.setMessageHandler(nil) } + } else { + getUrlChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let getEstimatedProgressChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getEstimatedProgress", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getEstimatedProgressChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getEstimatedProgress( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getEstimatedProgressChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getEstimatedProgress", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEstimatedProgressChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getEstimatedProgressChannel.setMessageHandler(nil) } + } else { + getEstimatedProgressChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let loadChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.load", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let requestArg = args[1] as! URLRequestWrapper - do { - try api.pigeonDelegate.load( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.load", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let requestArg = args[1] as! URLRequestWrapper + do { + try api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadChannel.setMessageHandler(nil) } + } else { + loadChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let loadHtmlStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadHtmlString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadHtmlStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let stringArg = args[1] as! String - let baseUrlArg: String? = nilOrValue(args[2]) - do { - try api.pigeonDelegate.loadHtmlString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, - baseUrl: baseUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadHtmlStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadHtmlString", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadHtmlStringChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let stringArg = args[1] as! String + let baseUrlArg: String? = nilOrValue(args[2]) + do { + try api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, baseUrl: baseUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadHtmlStringChannel.setMessageHandler(nil) } + } else { + loadHtmlStringChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let loadFileUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFileUrl", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFileUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let urlArg = args[1] as! String - let readAccessUrlArg = args[2] as! String - do { - try api.pigeonDelegate.loadFileUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, - readAccessUrl: readAccessUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadFileUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFileUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFileUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let urlArg = args[1] as! String + let readAccessUrlArg = args[2] as! String + do { + try api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, readAccessUrl: readAccessUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadFileUrlChannel.setMessageHandler(nil) } + } else { + loadFileUrlChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let loadFlutterAssetChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFlutterAsset", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFlutterAssetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let keyArg = args[1] as! String - do { - try api.pigeonDelegate.loadFlutterAsset( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadFlutterAssetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFlutterAsset", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFlutterAssetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let keyArg = args[1] as! String + do { + try api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadFlutterAssetChannel.setMessageHandler(nil) } + } else { + loadFlutterAssetChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let canGoBackChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoBack", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoBack( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let canGoBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoBack", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - canGoBackChannel.setMessageHandler(nil) } + } else { + canGoBackChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let canGoForwardChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoForward", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoForward( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let canGoForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoForward", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - canGoForwardChannel.setMessageHandler(nil) } + } else { + canGoForwardChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let goBackChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goBack", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let goBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goBack", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - goBackChannel.setMessageHandler(nil) } + } else { + goBackChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let goForwardChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goForward", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let goForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goForward", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - goForwardChannel.setMessageHandler(nil) } + } else { + goForwardChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let reloadChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.reload", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - reloadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.reload", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - reloadChannel.setMessageHandler(nil) } + } else { + reloadChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let getTitleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getTitle", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getTitleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getTitle( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getTitleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getTitle", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getTitleChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getTitleChannel.setMessageHandler(nil) } + } else { + getTitleChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsBackForwardNavigationGestures", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsBackForwardNavigationGestures( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsBackForwardNavigationGestures", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) } + } else { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setCustomUserAgentChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setCustomUserAgent", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let userAgentArg: String? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setCustomUserAgent( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let userAgentArg: String? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setCustomUserAgentChannel.setMessageHandler(nil) } + } else { + setCustomUserAgentChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let evaluateJavaScriptChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.evaluateJavaScript", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - evaluateJavaScriptChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let javaScriptStringArg = args[1] as! String - api.pigeonDelegate.evaluateJavaScript( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } + let evaluateJavaScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.evaluateJavaScript", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + evaluateJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let javaScriptStringArg = args[1] as! String + api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } - } else { - evaluateJavaScriptChannel.setMessageHandler(nil) } + } else { + evaluateJavaScriptChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setInspectableChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setInspectable", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setInspectableChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let inspectableArg = args[1] as! Bool - do { - try api.pigeonDelegate.setInspectable( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setInspectableChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setInspectable", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setInspectableChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let inspectableArg = args[1] as! Bool + do { + try api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setInspectableChannel.setMessageHandler(nil) } + } else { + setInspectableChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let getCustomUserAgentChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getCustomUserAgent", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } #endif } #if !os(macOS) - ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebView, 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.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(())) - } + ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) } } } + } #endif } -protocol PigeonApiDelegateNSViewWKWebView { - #if !os(iOS) - func pigeonDefaultConstructor( - pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration - ) throws -> WKWebView - #endif - #if !os(iOS) - /// The object that contains the configuration details for the web view. - func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws - -> WKWebViewConfiguration - #endif - #if !os(iOS) - /// The object you use to integrate custom user interface elements, such as - /// contextual menus or panels, into web view interactions. - func setUIDelegate( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws - #endif - #if !os(iOS) - /// The object you use to manage navigation behavior for the web view. - func setNavigationDelegate( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate - ) throws - #endif - #if !os(iOS) - /// The URL for the current webpage. - func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? - #endif - #if !os(iOS) - /// An estimate of what fraction of the current navigation has been loaded. - func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws - -> Double - #endif - #if !os(iOS) - /// Loads the web content that the specified URL request object references and - /// navigates to that content. - func load( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) - throws - #endif - #if !os(iOS) - /// Loads the contents of the specified HTML string and navigates to it. - func loadHtmlString( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, - baseUrl: String?) throws - #endif - #if !os(iOS) - /// Loads the web content from the specified file and navigates to it. - func loadFileUrl( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, - readAccessUrl: String) throws - #endif - #if !os(iOS) - /// Convenience method to load a Flutter asset. - func loadFlutterAsset( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws - #endif - #if !os(iOS) - /// A Boolean value that indicates whether there is a valid back item in the - /// back-forward list. - func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool - #endif - #if !os(iOS) - /// A Boolean value that indicates whether there is a valid forward item in - /// the back-forward list. - func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool - #endif - #if !os(iOS) - /// Navigates to the back item in the back-forward list. - func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws - #endif - #if !os(iOS) - /// Navigates to the forward item in the back-forward list. - func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + +/* +// 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 Foundation +import UIKit +import WebKit + + +/// ProxyApi implementation for `UIViewWKWebView`. +/// +/// 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 WebViewProxyAPIDelegate : PigeonApiDelegateUIViewWKWebView { + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView { + return UIViewWKWebView(,initialConfiguration: initialConfiguration) + } + + func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: UIViewWKWebView): WKWebViewConfiguration { + return pigeonInstance.configuration + } + + func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: UIViewWKWebView): UIScrollView { + return pigeonInstance.scrollView + } + + func setUIDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws { + pigeonInstance.uIDelegate = delegate: delegate + } + + func setNavigationDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws { + pigeonInstance.navigationDelegate = delegate: delegate + } + + func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.url + } + + func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Double { + return pigeonInstance.estimatedProgress + } + + func load(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws { + pigeonInstance.load(request: request) + } + + func loadHtmlString(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws { + pigeonInstance.loadHtmlString(string: string, baseUrl: baseUrl) + } + + func loadFileUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws { + pigeonInstance.loadFileUrl(url: url, readAccessUrl: readAccessUrl) + } + + func loadFlutterAsset(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws { + pigeonInstance.loadFlutterAsset(key: key) + } + + func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { + return pigeonInstance.canGoBack() + } + + func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { + return pigeonInstance.canGoForward() + } + + func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.goBack() + } + + func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.goForward() + } + + func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.reload() + } + + func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.title + } + + func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { + pigeonInstance.allowsBackForwardNavigationGestures = allow: allow + } + + func setCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws { + pigeonInstance.customUserAgent = userAgent: userAgent + } + + func evaluateJavaScript(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) { + return pigeonInstance.evaluateJavaScript(javaScriptString: javaScriptString) + } + + func setInspectable(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws { + pigeonInstance.inspectable = inspectable: inspectable + } + + func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.customUserAgent + } + + func setAllowsLinkPreview(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { + pigeonInstance.allowsLinkPreview = allow: allow + } + +} +*/ + +/* +// 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 UIKit +import WebKit +import Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebViewProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: TestWebViewConfiguration) + XCTAssertNotNil(instance) + } + + func testConfiguration() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = try? api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.configuration) + } + + func testScrollView() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = try? api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.scrollView) + } + + func testSetUIDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let delegate = TestUIDelegate + api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setUIDelegateArgs, [delegate]) + } + + func testSetNavigationDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let delegate = TestNavigationDelegate + api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setNavigationDelegateArgs, [delegate]) + } + + func testGetUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getUrlCalled) + XCTAssertEqual(value, instance.getUrl()) + } + + func testGetEstimatedProgress() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getEstimatedProgressCalled) + XCTAssertEqual(value, instance.getEstimatedProgress()) + } + + func testLoad() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let request = TestURLRequestWrapper + api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: instance, request: request) + + XCTAssertEqual(instance.loadArgs, [request]) + } + + func testLoadHtmlString() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let string = "myString" + let baseUrl = "myString" + api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: instance, string: string, baseUrl: baseUrl) + + XCTAssertEqual(instance.loadHtmlStringArgs, [string, baseUrl]) + } + + func testLoadFileUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let url = "myString" + let readAccessUrl = "myString" + api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: instance, url: url, readAccessUrl: readAccessUrl) + + XCTAssertEqual(instance.loadFileUrlArgs, [url, readAccessUrl]) + } + + func testLoadFlutterAsset() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let key = "myString" + api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: instance, key: key) + + XCTAssertEqual(instance.loadFlutterAssetArgs, [key]) + } + + func testCanGoBack() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.canGoBackCalled) + XCTAssertEqual(value, instance.canGoBack()) + } + + func testCanGoForward() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.canGoForwardCalled) + XCTAssertEqual(value, instance.canGoForward()) + } + + func testGoBack() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.goBackCalled) + } + + func testGoForward() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.goForwardCalled) + } + + func testReload() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.reloadCalled) + } + + func testGetTitle() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getTitleCalled) + XCTAssertEqual(value, instance.getTitle()) + } + + func testSetAllowsBackForwardNavigationGestures() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let allow = true + api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsBackForwardNavigationGesturesArgs, [allow]) + } + + func testSetCustomUserAgent() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let userAgent = "myString" + api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: instance, userAgent: userAgent) + + XCTAssertEqual(instance.setCustomUserAgentArgs, [userAgent]) + } + + func testEvaluateJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let javaScriptString = "myString" + let value = api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: instance, javaScriptString: javaScriptString) + + XCTAssertEqual(instance.evaluateJavaScriptArgs, [javaScriptString]) + XCTAssertEqual(value, instance.evaluateJavaScript(javaScriptString: javaScriptString)) + } + + func testSetInspectable() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let inspectable = true + api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: instance, inspectable: inspectable) + + XCTAssertEqual(instance.setInspectableArgs, [inspectable]) + } + + func testGetCustomUserAgent() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getCustomUserAgentCalled) + XCTAssertEqual(value, instance.getCustomUserAgent()) + } + + func testSetAllowsLinkPreview() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let allow = true + api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsLinkPreviewArgs, [allow]) + } + +} +class TestWebView: UIViewWKWebView { + private var configurationTestValue = TestWebViewConfiguration + private var scrollViewTestValue = TestScrollView + var setUIDelegateArgs: [AnyHashable?]? = nil + var setNavigationDelegateArgs: [AnyHashable?]? = nil + var getUrlCalled = false + var getEstimatedProgressCalled = false + var loadArgs: [AnyHashable?]? = nil + var loadHtmlStringArgs: [AnyHashable?]? = nil + var loadFileUrlArgs: [AnyHashable?]? = nil + var loadFlutterAssetArgs: [AnyHashable?]? = nil + var canGoBackCalled = false + var canGoForwardCalled = false + var goBackCalled = false + var goForwardCalled = false + var reloadCalled = false + var getTitleCalled = false + var setAllowsBackForwardNavigationGesturesArgs: [AnyHashable?]? = nil + var setCustomUserAgentArgs: [AnyHashable?]? = nil + var evaluateJavaScriptArgs: [AnyHashable?]? = nil + var setInspectableArgs: [AnyHashable?]? = nil + var getCustomUserAgentCalled = false + var setAllowsLinkPreviewArgs: [AnyHashable?]? = nil + + override var configuration: WKWebViewConfiguration { + return configurationTestValue + } + override var scrollView: UIScrollView { + return scrollViewTestValue + } + + override func setUIDelegate() { + setUIDelegateArgs = [delegate] + } + override func setNavigationDelegate() { + setNavigationDelegateArgs = [delegate] + } + override func getUrl() { + getUrlCalled = true + } + override func getEstimatedProgress() { + getEstimatedProgressCalled = true + } + override func load() { + loadArgs = [request] + } + override func loadHtmlString() { + loadHtmlStringArgs = [string, baseUrl] + } + override func loadFileUrl() { + loadFileUrlArgs = [url, readAccessUrl] + } + override func loadFlutterAsset() { + loadFlutterAssetArgs = [key] + } + override func canGoBack() { + canGoBackCalled = true + } + override func canGoForward() { + canGoForwardCalled = true + } + override func goBack() { + goBackCalled = true + } + override func goForward() { + goForwardCalled = true + } + override func reload() { + reloadCalled = true + } + override func getTitle() { + getTitleCalled = true + } + override func setAllowsBackForwardNavigationGestures() { + setAllowsBackForwardNavigationGesturesArgs = [allow] + } + override func setCustomUserAgent() { + setCustomUserAgentArgs = [userAgent] + } + override func evaluateJavaScript() { + evaluateJavaScriptArgs = [javaScriptString] + return -1 + } + override func setInspectable() { + setInspectableArgs = [inspectable] + } + override func getCustomUserAgent() { + getCustomUserAgentCalled = true + } + override func setAllowsLinkPreview() { + setAllowsLinkPreviewArgs = [allow] + } +} +*/ + +protocol PigeonApiDelegateNSViewWKWebView { + #if !os(iOS) + func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView + #endif + #if !os(iOS) + /// The object that contains the configuration details for the web view. + func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> WKWebViewConfiguration + #endif + #if !os(iOS) + /// The object you use to integrate custom user interface elements, such as + /// contextual menus or panels, into web view interactions. + func setUIDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws + #endif + #if !os(iOS) + /// The object you use to manage navigation behavior for the web view. + func setNavigationDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws + #endif + #if !os(iOS) + /// The URL for the current webpage. + func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + #endif + #if !os(iOS) + /// An estimate of what fraction of the current navigation has been loaded. + func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Double + #endif + #if !os(iOS) + /// Loads the web content that the specified URL request object references and + /// navigates to that content. + func load(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws + #endif + #if !os(iOS) + /// Loads the contents of the specified HTML string and navigates to it. + func loadHtmlString(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws + #endif + #if !os(iOS) + /// Loads the web content from the specified file and navigates to it. + func loadFileUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws + #endif + #if !os(iOS) + /// Convenience method to load a Flutter asset. + func loadFlutterAsset(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws + #endif + #if !os(iOS) + /// A Boolean value that indicates whether there is a valid back item in the + /// back-forward list. + func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + #endif + #if !os(iOS) + /// A Boolean value that indicates whether there is a valid forward item in + /// the back-forward list. + func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + #endif + #if !os(iOS) + /// Navigates to the back item in the back-forward list. + func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + #endif + #if !os(iOS) + /// Navigates to the forward item in the back-forward list. + func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// Reloads the current webpage. - func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Reloads the current webpage. + func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// The page title. - func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The page title. + func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// A Boolean value that indicates whether horizontal swipe gestures trigger - /// backward and forward page navigation. - func setAllowsBackForwardNavigationGestures( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// A Boolean value that indicates whether horizontal swipe gestures trigger + /// backward and forward page navigation. + func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif #if !os(iOS) - /// The custom user agent string. - func setCustomUserAgent( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws + /// The custom user agent string. + func setCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws #endif #if !os(iOS) - /// Evaluates the specified JavaScript string. - func evaluateJavaScript( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, - completion: @escaping (Result) -> Void) + /// Evaluates the specified JavaScript string. + func evaluateJavaScript(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) #endif #if !os(iOS) - /// A Boolean value that indicates whether you can inspect the view with - /// Safari Web Inspector. - func setInspectable( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws + /// A Boolean value that indicates whether you can inspect the view with + /// Safari Web Inspector. + func setInspectable(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws #endif #if !os(iOS) - /// The custom user agent string. - func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws - -> String? + /// The custom user agent string. + func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// Whether to allow previews for link destinations and detected data such as - /// addresses and phone numbers. - /// - /// Defaults to true. - func setAllowsLinkPreview( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif } protocol PigeonApiProtocolNSViewWKWebView { } -final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { +final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSViewWKWebView ///An implementation of [NSObject] used to access callback methods @@ -5483,534 +7245,901 @@ final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiWKWebView(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateNSViewWKWebView - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSViewWKWebView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSViewWKWebView? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSViewWKWebView?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(iOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let initialConfigurationArg = args[1] as! WKWebViewConfiguration - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, initialConfiguration: initialConfigurationArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + let initialConfigurationArg = args[1] as! WKWebViewConfiguration + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: initialConfigurationArg), +withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let configurationChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.configuration", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - configurationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.configuration( - pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let configurationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.configuration", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + configurationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - configurationChannel.setMessageHandler(nil) } + } else { + configurationChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setUIDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setUIDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setUIDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKUIDelegate - do { - try api.pigeonDelegate.setUIDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setUIDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setUIDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setUIDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKUIDelegate + do { + try api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setUIDelegateChannel.setMessageHandler(nil) } + } else { + setUIDelegateChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setNavigationDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setNavigationDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setNavigationDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKNavigationDelegate - do { - try api.pigeonDelegate.setNavigationDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setNavigationDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setNavigationDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setNavigationDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKNavigationDelegate + do { + try api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setNavigationDelegateChannel.setMessageHandler(nil) } + } else { + setNavigationDelegateChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let getUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getUrl", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getUrlChannel.setMessageHandler(nil) } + } else { + getUrlChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let getEstimatedProgressChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getEstimatedProgress", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getEstimatedProgressChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getEstimatedProgress( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getEstimatedProgressChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getEstimatedProgress", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEstimatedProgressChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getEstimatedProgressChannel.setMessageHandler(nil) } + } else { + getEstimatedProgressChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let loadChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.load", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let requestArg = args[1] as! URLRequestWrapper - do { - try api.pigeonDelegate.load( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.load", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let requestArg = args[1] as! URLRequestWrapper + do { + try api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadChannel.setMessageHandler(nil) } + } else { + loadChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let loadHtmlStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadHtmlString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadHtmlStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let stringArg = args[1] as! String - let baseUrlArg: String? = nilOrValue(args[2]) - do { - try api.pigeonDelegate.loadHtmlString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, - baseUrl: baseUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadHtmlStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadHtmlString", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadHtmlStringChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let stringArg = args[1] as! String + let baseUrlArg: String? = nilOrValue(args[2]) + do { + try api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, baseUrl: baseUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadHtmlStringChannel.setMessageHandler(nil) } + } else { + loadHtmlStringChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let loadFileUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFileUrl", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFileUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let urlArg = args[1] as! String - let readAccessUrlArg = args[2] as! String - do { - try api.pigeonDelegate.loadFileUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, - readAccessUrl: readAccessUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadFileUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFileUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFileUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let urlArg = args[1] as! String + let readAccessUrlArg = args[2] as! String + do { + try api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, readAccessUrl: readAccessUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadFileUrlChannel.setMessageHandler(nil) } + } else { + loadFileUrlChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let loadFlutterAssetChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFlutterAsset", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFlutterAssetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let keyArg = args[1] as! String - do { - try api.pigeonDelegate.loadFlutterAsset( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadFlutterAssetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFlutterAsset", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFlutterAssetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let keyArg = args[1] as! String + do { + try api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadFlutterAssetChannel.setMessageHandler(nil) } + } else { + loadFlutterAssetChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let canGoBackChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoBack", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoBack( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let canGoBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoBack", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - canGoBackChannel.setMessageHandler(nil) } + } else { + canGoBackChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let canGoForwardChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoForward", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoForward( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let canGoForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoForward", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - canGoForwardChannel.setMessageHandler(nil) } + } else { + canGoForwardChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let goBackChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goBack", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let goBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goBack", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - goBackChannel.setMessageHandler(nil) } + } else { + goBackChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let goForwardChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goForward", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let goForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goForward", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - goForwardChannel.setMessageHandler(nil) } + } else { + goForwardChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let reloadChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.reload", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - reloadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.reload", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - reloadChannel.setMessageHandler(nil) } + } else { + reloadChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let getTitleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getTitle", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getTitleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getTitle( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getTitleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getTitle", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getTitleChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getTitleChannel.setMessageHandler(nil) } + } else { + getTitleChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsBackForwardNavigationGestures", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsBackForwardNavigationGestures( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsBackForwardNavigationGestures", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) } - #endif + } else { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) + } + #endif #if !os(iOS) - let setCustomUserAgentChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setCustomUserAgent", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let userAgentArg: String? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setCustomUserAgent( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let userAgentArg: String? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setCustomUserAgentChannel.setMessageHandler(nil) } + } else { + setCustomUserAgentChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let evaluateJavaScriptChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.evaluateJavaScript", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - evaluateJavaScriptChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let javaScriptStringArg = args[1] as! String - api.pigeonDelegate.evaluateJavaScript( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } + let evaluateJavaScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.evaluateJavaScript", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + evaluateJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let javaScriptStringArg = args[1] as! String + api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } - } else { - evaluateJavaScriptChannel.setMessageHandler(nil) } + } else { + evaluateJavaScriptChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setInspectableChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setInspectable", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setInspectableChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let inspectableArg = args[1] as! Bool - do { - try api.pigeonDelegate.setInspectable( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setInspectableChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setInspectable", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setInspectableChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let inspectableArg = args[1] as! Bool + do { + try api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setInspectableChannel.setMessageHandler(nil) } + } else { + setInspectableChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let getCustomUserAgentChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getCustomUserAgent", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } #endif } #if !os(iOS) - ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebView, 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.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(())) - } + ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) } } } + } #endif } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `NSViewWKWebView`. +/// +/// 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 WebViewProxyAPIDelegate : PigeonApiDelegateNSViewWKWebView { + func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView { + return NSViewWKWebView(,initialConfiguration: initialConfiguration) + } + + func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: NSViewWKWebView): WKWebViewConfiguration { + return pigeonInstance.configuration + } + + func setUIDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws { + pigeonInstance.uIDelegate = delegate: delegate + } + + func setNavigationDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws { + pigeonInstance.navigationDelegate = delegate: delegate + } + + func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.url + } + + func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Double { + return pigeonInstance.estimatedProgress + } + + func load(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws { + pigeonInstance.load(request: request) + } + + func loadHtmlString(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws { + pigeonInstance.loadHtmlString(string: string, baseUrl: baseUrl) + } + + func loadFileUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws { + pigeonInstance.loadFileUrl(url: url, readAccessUrl: readAccessUrl) + } + + func loadFlutterAsset(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws { + pigeonInstance.loadFlutterAsset(key: key) + } + + func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { + return pigeonInstance.canGoBack() + } + + func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { + return pigeonInstance.canGoForward() + } + + func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.goBack() + } + + func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.goForward() + } + + func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.reload() + } + + func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.title + } + + func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { + pigeonInstance.allowsBackForwardNavigationGestures = allow: allow + } + + func setCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws { + pigeonInstance.customUserAgent = userAgent: userAgent + } + + func evaluateJavaScript(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) { + return pigeonInstance.evaluateJavaScript(javaScriptString: javaScriptString) + } + + func setInspectable(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws { + pigeonInstance.inspectable = inspectable: inspectable + } + + func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.customUserAgent + } + + func setAllowsLinkPreview(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { + pigeonInstance.allowsLinkPreview = allow: allow + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebViewProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: TestWebViewConfiguration) + XCTAssertNotNil(instance) + } + + func testConfiguration() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = try? api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.configuration) + } + + func testSetUIDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let delegate = TestUIDelegate + api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setUIDelegateArgs, [delegate]) + } + + func testSetNavigationDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let delegate = TestNavigationDelegate + api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setNavigationDelegateArgs, [delegate]) + } + + func testGetUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getUrlCalled) + XCTAssertEqual(value, instance.getUrl()) + } + + func testGetEstimatedProgress() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getEstimatedProgressCalled) + XCTAssertEqual(value, instance.getEstimatedProgress()) + } + + func testLoad() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let request = TestURLRequestWrapper + api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: instance, request: request) + + XCTAssertEqual(instance.loadArgs, [request]) + } + + func testLoadHtmlString() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let string = "myString" + let baseUrl = "myString" + api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: instance, string: string, baseUrl: baseUrl) + + XCTAssertEqual(instance.loadHtmlStringArgs, [string, baseUrl]) + } + + func testLoadFileUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let url = "myString" + let readAccessUrl = "myString" + api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: instance, url: url, readAccessUrl: readAccessUrl) + + XCTAssertEqual(instance.loadFileUrlArgs, [url, readAccessUrl]) + } + + func testLoadFlutterAsset() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let key = "myString" + api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: instance, key: key) + + XCTAssertEqual(instance.loadFlutterAssetArgs, [key]) + } + + func testCanGoBack() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.canGoBackCalled) + XCTAssertEqual(value, instance.canGoBack()) + } + + func testCanGoForward() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.canGoForwardCalled) + XCTAssertEqual(value, instance.canGoForward()) + } + + func testGoBack() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.goBackCalled) + } + + func testGoForward() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.goForwardCalled) + } + + func testReload() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.reloadCalled) + } + + func testGetTitle() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getTitleCalled) + XCTAssertEqual(value, instance.getTitle()) + } + + func testSetAllowsBackForwardNavigationGestures() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let allow = true + api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsBackForwardNavigationGesturesArgs, [allow]) + } + + func testSetCustomUserAgent() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let userAgent = "myString" + api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: instance, userAgent: userAgent) + + XCTAssertEqual(instance.setCustomUserAgentArgs, [userAgent]) + } + + func testEvaluateJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let javaScriptString = "myString" + let value = api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: instance, javaScriptString: javaScriptString) + + XCTAssertEqual(instance.evaluateJavaScriptArgs, [javaScriptString]) + XCTAssertEqual(value, instance.evaluateJavaScript(javaScriptString: javaScriptString)) + } + + func testSetInspectable() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let inspectable = true + api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: instance, inspectable: inspectable) + + XCTAssertEqual(instance.setInspectableArgs, [inspectable]) + } + + func testGetCustomUserAgent() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getCustomUserAgentCalled) + XCTAssertEqual(value, instance.getCustomUserAgent()) + } + + func testSetAllowsLinkPreview() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let allow = true + api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsLinkPreviewArgs, [allow]) + } + +} +class TestWebView: NSViewWKWebView { + private var configurationTestValue = TestWebViewConfiguration + var setUIDelegateArgs: [AnyHashable?]? = nil + var setNavigationDelegateArgs: [AnyHashable?]? = nil + var getUrlCalled = false + var getEstimatedProgressCalled = false + var loadArgs: [AnyHashable?]? = nil + var loadHtmlStringArgs: [AnyHashable?]? = nil + var loadFileUrlArgs: [AnyHashable?]? = nil + var loadFlutterAssetArgs: [AnyHashable?]? = nil + var canGoBackCalled = false + var canGoForwardCalled = false + var goBackCalled = false + var goForwardCalled = false + var reloadCalled = false + var getTitleCalled = false + var setAllowsBackForwardNavigationGesturesArgs: [AnyHashable?]? = nil + var setCustomUserAgentArgs: [AnyHashable?]? = nil + var evaluateJavaScriptArgs: [AnyHashable?]? = nil + var setInspectableArgs: [AnyHashable?]? = nil + var getCustomUserAgentCalled = false + var setAllowsLinkPreviewArgs: [AnyHashable?]? = nil + + override var configuration: WKWebViewConfiguration { + return configurationTestValue + } + + override func setUIDelegate() { + setUIDelegateArgs = [delegate] + } + override func setNavigationDelegate() { + setNavigationDelegateArgs = [delegate] + } + override func getUrl() { + getUrlCalled = true + } + override func getEstimatedProgress() { + getEstimatedProgressCalled = true + } + override func load() { + loadArgs = [request] + } + override func loadHtmlString() { + loadHtmlStringArgs = [string, baseUrl] + } + override func loadFileUrl() { + loadFileUrlArgs = [url, readAccessUrl] + } + override func loadFlutterAsset() { + loadFlutterAssetArgs = [key] + } + override func canGoBack() { + canGoBackCalled = true + } + override func canGoForward() { + canGoForwardCalled = true + } + override func goBack() { + goBackCalled = true + } + override func goForward() { + goForwardCalled = true + } + override func reload() { + reloadCalled = true + } + override func getTitle() { + getTitleCalled = true + } + override func setAllowsBackForwardNavigationGestures() { + setAllowsBackForwardNavigationGesturesArgs = [allow] + } + override func setCustomUserAgent() { + setCustomUserAgentArgs = [userAgent] + } + override func evaluateJavaScript() { + evaluateJavaScriptArgs = [javaScriptString] + return -1 + } + override func setInspectable() { + setInspectableArgs = [inspectable] + } + override func getCustomUserAgent() { + getCustomUserAgentCalled = true + } + override func setAllowsLinkPreview() { + setAllowsLinkPreviewArgs = [allow] + } +} +*/ + open class PigeonApiDelegateWKWebView { } protocol PigeonApiProtocolWKWebView { } -final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { +final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebView ///An implementation of [NSObject] used to access callback methods @@ -6018,32 +8147,26 @@ final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebView) - { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebView, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKWebView, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -6067,35 +8190,19 @@ protocol PigeonApiDelegateWKUIDelegate { protocol PigeonApiProtocolWKUIDelegate { /// Creates a new web view. - func onCreateWebView( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - configuration configurationArg: WKWebViewConfiguration, - navigationAction navigationActionArg: WKNavigationAction, - completion: @escaping (Result) -> Void) + func onCreateWebView(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, configuration configurationArg: WKWebViewConfiguration, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. - func requestMediaCapturePermission( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, - completion: @escaping (Result) -> Void) + func requestMediaCapturePermission(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, completion: @escaping (Result) -> Void) /// Displays a JavaScript alert panel. - func runJavaScriptAlertPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - message messageArg: String, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void) + func runJavaScriptAlertPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) /// Displays a JavaScript confirm panel. - func runJavaScriptConfirmPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - message messageArg: String, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void) + func runJavaScriptConfirmPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) /// Displays a JavaScript text input panel. - func runJavaScriptTextInputPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void) + func runJavaScriptTextInputPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) } -final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { +final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUIDelegate ///An implementation of [NSObject] used to access callback methods @@ -6103,32 +8210,25 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUIDelegate - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUIDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUIDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUIDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -6140,34 +8240,25 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } ///Creates a Dart instance of WKUIDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKUIDelegate, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKUIDelegate, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + 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. - func onCreateWebView( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - configuration configurationArg: WKWebViewConfiguration, - navigationAction navigationActionArg: WKNavigationAction, - completion: @escaping (Result) -> Void - ) { + func onCreateWebView(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, configuration configurationArg: WKWebViewConfiguration, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6178,13 +8269,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.onCreateWebView" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [pigeonInstanceArg, webViewArg, configurationArg, navigationActionArg] as [Any?] - ) { response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.onCreateWebView" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, configurationArg, navigationActionArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6202,11 +8289,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. - func requestMediaCapturePermission( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, - completion: @escaping (Result) -> Void - ) { + func requestMediaCapturePermission(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6217,12 +8300,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, originArg, frameArg, typeArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, originArg, frameArg, typeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6233,11 +8313,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! PermissionDecision completion(.success(result)) @@ -6246,11 +8322,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } /// Displays a JavaScript alert panel. - func runJavaScriptAlertPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - message messageArg: String, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void - ) { + func runJavaScriptAlertPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6261,12 +8333,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptAlertPanel" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptAlertPanel" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6283,11 +8352,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } /// Displays a JavaScript confirm panel. - func runJavaScriptConfirmPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - message messageArg: String, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void - ) { + func runJavaScriptConfirmPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6298,12 +8363,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6314,11 +8376,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -6327,11 +8385,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } /// Displays a JavaScript text input panel. - func runJavaScriptTextInputPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void - ) { + func runJavaScriptTextInputPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6342,13 +8396,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptTextInputPanel" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [pigeonInstanceArg, webViewArg, promptArg, defaultTextArg, frameArg] as [Any?] - ) { response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptTextInputPanel" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, promptArg, defaultTextArg, frameArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6366,18 +8416,169 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } } + +/* +// 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 Foundation +import WebKit + +/// Implementation of `WKUIDelegate` that calls to Dart in callback methods. +class UIDelegateImpl: WKUIDelegate { + let api: PigeonApiProtocolWKUIDelegate + + init(api: PigeonApiProtocolWKUIDelegate) { + self.api = api + } + + func fixMe() { + api.onCreateWebView(pigeonInstance: self, webView: webView, configuration: configuration, navigationAction: navigationAction) { _ in } + } + + func fixMe() { + api.requestMediaCapturePermission(pigeonInstance: self, webView: webView, origin: origin, frame: frame, type: type) { _ in } + } + + func fixMe() { + api.runJavaScriptAlertPanel(pigeonInstance: self, webView: webView, message: message, frame: frame) { _ in } + } + + func fixMe() { + api.runJavaScriptConfirmPanel(pigeonInstance: self, webView: webView, message: message, frame: frame) { _ in } + } + + func fixMe() { + api.runJavaScriptTextInputPanel(pigeonInstance: self, webView: webView, prompt: prompt, defaultText: defaultText, frame: frame) { _ in } + } +} + +/// ProxyApi implementation for `WKUIDelegate`. +/// +/// 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 UIDelegateProxyAPIDelegate : PigeonApiDelegateWKUIDelegate { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUIDelegate) throws -> WKUIDelegate { + return WKUIDelegateImpl(api: pigeonApi) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class UIDelegateProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUIDelegate(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testOnCreateWebView() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let configuration = TestWebViewConfiguration + let navigationAction = TestNavigationAction + instance.onCreateWebView(webView: webView, configuration: configuration, navigationAction: navigationAction) + + XCTAssertEqual(api.onCreateWebViewArgs, [webView, configuration, navigationAction]) + } + + func testRequestMediaCapturePermission() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let origin = TestSecurityOrigin + let frame = TestFrameInfo + let type = .camera + instance.requestMediaCapturePermission(webView: webView, origin: origin, frame: frame, type: type) + + XCTAssertEqual(api.requestMediaCapturePermissionArgs, [webView, origin, frame, type]) + } + + func testRunJavaScriptAlertPanel() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let message = "myString" + let frame = TestFrameInfo + instance.runJavaScriptAlertPanel(webView: webView, message: message, frame: frame) + + XCTAssertEqual(api.runJavaScriptAlertPanelArgs, [webView, message, frame]) + } + + func testRunJavaScriptConfirmPanel() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let message = "myString" + let frame = TestFrameInfo + instance.runJavaScriptConfirmPanel(webView: webView, message: message, frame: frame) + + XCTAssertEqual(api.runJavaScriptConfirmPanelArgs, [webView, message, frame]) + } + + func testRunJavaScriptTextInputPanel() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let prompt = "myString" + let defaultText = "myString" + let frame = TestFrameInfo + instance.runJavaScriptTextInputPanel(webView: webView, prompt: prompt, defaultText: defaultText, frame: frame) + + XCTAssertEqual(api.runJavaScriptTextInputPanelArgs, [webView, prompt, defaultText, frame]) + } + +} +class TestUIDelegateApi: PigeonApiProtocolWKUIDelegate { + var onCreateWebViewArgs: [AnyHashable?]? = nil + var requestMediaCapturePermissionArgs: [AnyHashable?]? = nil + var runJavaScriptAlertPanelArgs: [AnyHashable?]? = nil + var runJavaScriptConfirmPanelArgs: [AnyHashable?]? = nil + var runJavaScriptTextInputPanelArgs: [AnyHashable?]? = nil + + func onCreateWebView(webView: WKWebView, configuration: WKWebViewConfiguration, navigationAction: WKNavigationAction) throws { + onCreateWebViewArgs = [webViewArg, configurationArg, navigationActionArg] + } + func requestMediaCapturePermission(webView: WKWebView, origin: WKSecurityOrigin, frame: WKFrameInfo, type: MediaCaptureType) throws -> PermissionDecision { + requestMediaCapturePermissionArgs = [webViewArg, originArg, frameArg, typeArg] + } + func runJavaScriptAlertPanel(webView: WKWebView, message: String, frame: WKFrameInfo) throws { + runJavaScriptAlertPanelArgs = [webViewArg, messageArg, frameArg] + } + func runJavaScriptConfirmPanel(webView: WKWebView, message: String, frame: WKFrameInfo) throws -> Bool { + runJavaScriptConfirmPanelArgs = [webViewArg, messageArg, frameArg] + } + func runJavaScriptTextInputPanel(webView: WKWebView, prompt: String, defaultText: String?, frame: WKFrameInfo) throws -> String? { + runJavaScriptTextInputPanelArgs = [webViewArg, promptArg, defaultTextArg, frameArg] + } +} +*/ + protocol PigeonApiDelegateWKHTTPCookieStore { /// Sets a cookie policy that indicates whether the cookie store allows cookie /// storage. - func setCookie( - pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, - completion: @escaping (Result) -> Void) + func setCookie(pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolWKHTTPCookieStore { } -final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { +final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKHTTPCookieStore ///An implementation of [NSObject] used to access callback methods @@ -6385,33 +8586,23 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKHTTPCookieStore - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKHTTPCookieStore) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKHTTPCookieStore? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKHTTPCookieStore?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setCookieChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.setCookie", - binaryMessenger: binaryMessenger, codec: codec) + let setCookieChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.setCookie", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setCookieChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKHTTPCookieStore let cookieArg = args[1] as! HTTPCookie - api.pigeonDelegate.setCookie( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, cookie: cookieArg - ) { result in + api.pigeonDelegate.setCookie(pigeonApi: api, pigeonInstance: pigeonInstanceArg, cookie: cookieArg) { result in switch result { case .success: reply(wrapResult(nil)) @@ -6426,26 +8617,21 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } ///Creates a Dart instance of WKHTTPCookieStore and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKHTTPCookieStore, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKHTTPCookieStore, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -6463,29 +8649,80 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKHTTPCookieStore`. +/// +/// 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 HTTPCookieStoreProxyAPIDelegate : PigeonApiDelegateWKHTTPCookieStore { + func setCookie(pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, completion: @escaping (Result) -> Void) { + pigeonInstance.cookie = cookie: cookie + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class HTTPCookieStoreProxyAPITests: XCTestCase { + func testSetCookie() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKHTTPCookieStore(registrar) + + let instance = TestHTTPCookieStore() + let cookie = TestHTTPCookie + api.pigeonDelegate.setCookie(pigeonApi: api, pigeonInstance: instance, cookie: cookie) + + XCTAssertEqual(instance.setCookieArgs, [cookie]) + } + +} +class TestHTTPCookieStore: WKHTTPCookieStore { + var setCookieArgs: [AnyHashable?]? = nil + + + override func setCookie() { + setCookieArgs = [cookie] + } +} +*/ + protocol PigeonApiDelegateUIScrollViewDelegate { #if !os(macOS) - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws - -> UIScrollViewDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate #endif } protocol PigeonApiProtocolUIScrollViewDelegate { #if !os(macOS) - /// Tells the delegate when the user scrolls the content view within the - /// scroll view. - /// - /// Note that this is a convenient method that includes the `contentOffset` of - /// the `scrollView`. - func scrollViewDidScroll( - pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, - scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, - completion: @escaping (Result) -> Void) - #endif + /// Tells the delegate when the user scrolls the content view within the + /// scroll view. + /// + /// Note that this is a convenient method that includes the `contentOffset` of + /// the `scrollView`. + func scrollViewDidScroll(pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, completion: @escaping (Result) -> Void) #endif } -final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate { +final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIScrollViewDelegate ///An implementation of [NSObject] used to access callback methods @@ -6493,112 +8730,55 @@ final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateUIScrollViewDelegate - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollViewDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollViewDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollViewDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) + } #endif } #if !os(macOS) - ///Creates a Dart instance of UIScrollViewDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: UIScrollViewDelegate, - 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.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(())) - } - } - } - } - #endif - #if !os(macOS) - /// Tells the delegate when the user scrolls the content view within the - /// scroll view. - /// - /// Note that this is a convenient method that includes the `contentOffset` of - /// the `scrollView`. - func scrollViewDidScroll( - pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, - scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } + ///Creates a Dart instance of UIScrollViewDelegate and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: UIScrollViewDelegate, 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.UIScrollViewDelegate.scrollViewDidScroll" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, scrollViewArg, xArg, yArg] as [Any?]) { response in + 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 @@ -6613,22 +8793,130 @@ final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate } } } + } + #endif + #if !os(macOS) + /// Tells the delegate when the user scrolls the content view within the + /// scroll view. + /// + /// Note that this is a convenient method that includes the `contentOffset` of + /// the `scrollView`. + func scrollViewDidScroll(pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, completion: @escaping (Result) -> Void) { + if pigeonRegistrar.ignoreCallsToDart { + completion( + .failure( + PigeonError( + code: "ignore-calls-error", + message: "Calls to Dart are being ignored.", details: ""))) + return + } + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.scrollViewDidScroll" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, scrollViewArg, xArg, yArg] 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(())) + } + } + } #endif } + +/* +// 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 Foundation +import UIKit + +/// Implementation of `UIScrollViewDelegate` that calls to Dart in callback methods. +class ScrollViewDelegateImpl: UIScrollViewDelegate { + let api: PigeonApiProtocolUIScrollViewDelegate + + init(api: PigeonApiProtocolUIScrollViewDelegate) { + self.api = api + } + + func fixMe() { + api.scrollViewDidScroll(pigeonInstance: self, scrollView: scrollView, x: x, y: y) { _ in } + } +} + +/// ProxyApi implementation for `UIScrollViewDelegate`. +/// +/// 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 ScrollViewDelegateProxyAPIDelegate : PigeonApiDelegateUIScrollViewDelegate { + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate { + return UIScrollViewDelegateImpl(api: pigeonApi) + } + +} +*/ + +/* +// 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 UIKit +import Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ScrollViewDelegateProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollViewDelegate(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testScrollViewDidScroll() { + let api = TestScrollViewDelegateApi() + let instance = ScrollViewDelegateImpl(api: api) + let scrollView = TestScrollView + let x = 1.0 + let y = 1.0 + instance.scrollViewDidScroll(scrollView: scrollView, x: x, y: y) + + XCTAssertEqual(api.scrollViewDidScrollArgs, [scrollView, x, y]) + } + +} +class TestScrollViewDelegateApi: PigeonApiProtocolUIScrollViewDelegate { + var scrollViewDidScrollArgs: [AnyHashable?]? = nil + + func scrollViewDidScroll(scrollView: UIScrollView, x: Double, y: Double) throws { + scrollViewDidScrollArgs = [scrollViewArg, xArg, yArg] + } +} +*/ + protocol PigeonApiDelegateURLCredential { /// Creates a URL credential instance for internet password authentication /// with a given user name and password, using a given persistence setting. - func withUser( - pigeonApi: PigeonApiURLCredential, user: String, password: String, - persistence: UrlCredentialPersistence - ) throws -> URLCredential + func withUser(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence) throws -> URLCredential } protocol PigeonApiProtocolURLCredential { } -final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { +final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLCredential ///An implementation of [NSObject] used to access callback methods @@ -6636,24 +8924,17 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLCredential - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLCredential) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLCredential? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLCredential?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let withUserChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUser", - binaryMessenger: binaryMessenger, codec: codec) + let withUserChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUser", binaryMessenger: binaryMessenger, codec: codec) if let api = api { withUserChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6663,9 +8944,8 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { let persistenceArg = args[3] as! UrlCredentialPersistence do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.withUser( - pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.withUser(pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -6677,26 +8957,21 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { } ///Creates a Dart instance of URLCredential and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLCredential, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLCredential, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -6714,29 +8989,68 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URLCredential`. +/// +/// 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 URLCredentialProxyAPIDelegate : PigeonApiDelegateURLCredential { + func withUser(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence) throws -> URLCredential { + return URLCredential(,user: user, password: password, persistence: persistence) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLCredentialProxyAPITests: XCTestCase { + func testWithUser() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLCredential(registrar) + + let instance = try? api.pigeonDelegate.withUser(pigeonApi: api, user: "myString", password: "myString", persistence: .none) + XCTAssertNotNil(instance) + } + +} +*/ + protocol PigeonApiDelegateURLProtectionSpace { /// The receiver’s host. - func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws - -> String + func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String /// The receiver’s port. - func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws - -> Int64 + func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> Int64 /// The receiver’s authentication realm. - func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws - -> String? + func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? /// The authentication method used by the receiver. - func authenticationMethod( - pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace - ) throws -> String? + func authenticationMethod(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? /// A representation of the server’s SSL transaction state. - func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) - throws -> SecTrustWrapper? + func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> SecTrustWrapper? } protocol PigeonApiProtocolURLProtectionSpace { } -final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { +final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLProtectionSpace ///An implementation of [NSObject] used to access callback methods @@ -6744,32 +9058,23 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateURLProtectionSpace - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLProtectionSpace) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getServerTrustChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", - binaryMessenger: binaryMessenger, codec: codec) + let getServerTrustChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getServerTrustChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLProtectionSpace do { - let result = try api.pigeonDelegate.getServerTrust( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getServerTrust(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -6781,34 +9086,26 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } ///Creates a Dart instance of URLProtectionSpace and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLProtectionSpace, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLProtectionSpace, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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 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 + 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 @@ -6825,17 +9122,143 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URLProtectionSpace`. +/// +/// 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 URLProtectionSpaceProxyAPIDelegate : PigeonApiDelegateURLProtectionSpace { + func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String { + return pigeonInstance.host + } + + func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> Int64 { + return pigeonInstance.port + } + + func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? { + return pigeonInstance.realm + } + + func authenticationMethod(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? { + return pigeonInstance.authenticationMethod + } + + func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> SecTrustWrapper? { + return pigeonInstance.serverTrust + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLProtectionSpaceProxyAPITests: XCTestCase { + func testHost() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = try? api.pigeonDelegate.host(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.host) + } + + func testPort() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = try? api.pigeonDelegate.port(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.port) + } + + func testRealm() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = try? api.pigeonDelegate.realm(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.realm) + } + + func testAuthenticationMethod() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = try? api.pigeonDelegate.authenticationMethod(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.authenticationMethod) + } + + func testGetServerTrust() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = api.pigeonDelegate.getServerTrust(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getServerTrustCalled) + XCTAssertEqual(value, instance.getServerTrust()) + } + +} +class TestURLProtectionSpace: URLProtectionSpace { + private var hostTestValue = "myString" + private var portTestValue = 0 + private var realmTestValue = "myString" + private var authenticationMethodTestValue = "myString" + var getServerTrustCalled = false + + override var host: String { + return hostTestValue + } + override var port: Int64 { + return portTestValue + } + override var realm: String { + return realmTestValue + } + override var authenticationMethod: String { + return authenticationMethodTestValue + } + + override func getServerTrust() { + getServerTrustCalled = true + } +} +*/ + protocol PigeonApiDelegateURLAuthenticationChallenge { /// The receiver’s protection space. - func getProtectionSpace( - pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge - ) throws -> URLProtectionSpace + func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace } protocol PigeonApiProtocolURLAuthenticationChallenge { } -final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticationChallenge { +final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticationChallenge { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLAuthenticationChallenge ///An implementation of [NSObject] used to access callback methods @@ -6843,33 +9266,23 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateURLAuthenticationChallenge - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLAuthenticationChallenge) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLAuthenticationChallenge? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLAuthenticationChallenge?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getProtectionSpaceChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.getProtectionSpace", - binaryMessenger: binaryMessenger, codec: codec) + let getProtectionSpaceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.getProtectionSpace", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getProtectionSpaceChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLAuthenticationChallenge do { - let result = try api.pigeonDelegate.getProtectionSpace( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getProtectionSpace(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -6881,27 +9294,21 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat } ///Creates a Dart instance of URLAuthenticationChallenge and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLAuthenticationChallenge, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLAuthenticationChallenge, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -6919,6 +9326,62 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URLAuthenticationChallenge`. +/// +/// 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 URLAuthenticationChallengeProxyAPIDelegate : PigeonApiDelegateURLAuthenticationChallenge { + func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace { + return pigeonInstance.protectionSpace + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLAuthenticationChallengeProxyAPITests: XCTestCase { + func testGetProtectionSpace() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLAuthenticationChallenge(registrar) + + let instance = TestURLAuthenticationChallenge() + let value = api.pigeonDelegate.getProtectionSpace(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getProtectionSpaceCalled) + XCTAssertEqual(value, instance.getProtectionSpace()) + } + +} +class TestURLAuthenticationChallenge: URLAuthenticationChallenge { + var getProtectionSpaceCalled = false + + + override func getProtectionSpace() { + getProtectionSpaceCalled = true + } +} +*/ + protocol PigeonApiDelegateURL { /// The absolute string for the URL. func getAbsoluteString(pigeonApi: PigeonApiURL, pigeonInstance: URL) throws -> String @@ -6927,7 +9390,7 @@ protocol PigeonApiDelegateURL { protocol PigeonApiProtocolURL { } -final class PigeonApiURL: PigeonApiProtocolURL { +final class PigeonApiURL: PigeonApiProtocolURL { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURL ///An implementation of [NSObject] used to access callback methods @@ -6943,19 +9406,15 @@ final class PigeonApiURL: PigeonApiProtocolURL { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getAbsoluteStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URL.getAbsoluteString", - binaryMessenger: binaryMessenger, codec: codec) + let getAbsoluteStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URL.getAbsoluteString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAbsoluteStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URL do { - let result = try api.pigeonDelegate.getAbsoluteString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAbsoluteString(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -6967,26 +9426,21 @@ final class PigeonApiURL: PigeonApiProtocolURL { } ///Creates a Dart instance of URL and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URL, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URL, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -7004,19 +9458,73 @@ final class PigeonApiURL: PigeonApiProtocolURL { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URL`. +/// +/// 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 URLProxyAPIDelegate : PigeonApiDelegateURL { + func getAbsoluteString(pigeonApi: PigeonApiURL, pigeonInstance: URL) throws -> String { + return pigeonInstance.absoluteString + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLProxyAPITests: XCTestCase { + func testGetAbsoluteString() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURL(registrar) + + let instance = TestURL() + let value = api.pigeonDelegate.getAbsoluteString(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getAbsoluteStringCalled) + XCTAssertEqual(value, instance.getAbsoluteString()) + } + +} +class TestURL: URL { + var getAbsoluteStringCalled = false + + + override func getAbsoluteString() { + getAbsoluteStringCalled = true + } +} +*/ + 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 + func setAllowsContentJavaScript(pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) throws } protocol PigeonApiProtocolWKWebpagePreferences { } -final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { +final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebpagePreferences ///An implementation of [NSObject] used to access callback methods @@ -7024,35 +9532,25 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKWebpagePreferences - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebpagePreferences) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + 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) + 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) + try api.pigeonDelegate.setAllowsContentJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -7061,21 +9559,16 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } else { setAllowsContentJavaScriptChannel.setMessageHandler(nil) } - } else { + } else { let setAllowsContentJavaScriptChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.setAllowsContentJavaScript", + 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 - ))) + reply(wrapError(FlutterError(code: "PigeonUnsupportedOperationError", + message: "Call to setAllowsContentJavaScript requires @available(iOS 13.0.0, macOS 10.15.0, *).", + details: nil + ))) } } else { setAllowsContentJavaScriptChannel.setMessageHandler(nil) @@ -7085,26 +9578,21 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences ///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 - ) { + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -7122,22 +9610,75 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } } } + +/* +// 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 Foundation +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 { + func setAllowsContentJavaScript(pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) throws { + pigeonInstance.allowsContentJavaScript = allow: allow + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebpagePreferencesProxyAPITests: XCTestCase { + func testSetAllowsContentJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebpagePreferences(registrar) + + let instance = TestWebpagePreferences() + let allow = true + api.pigeonDelegate.setAllowsContentJavaScript(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsContentJavaScriptArgs, [allow]) + } + +} +class TestWebpagePreferences: WKWebpagePreferences { + var setAllowsContentJavaScriptArgs: [AnyHashable?]? = nil + + + override func setAllowsContentJavaScript() { + setAllowsContentJavaScriptArgs = [allow] + } +} +*/ + protocol PigeonApiDelegateGetTrustResultResponse { /// The result code from the most recent trust evaluation. - func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) - throws -> DartSecTrustResultType + func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType /// A result code. /// /// See https://developer.apple.com/documentation/security/security-framework-result-codes?language=objc. - func resultCode( - pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse - ) throws -> Int64 + func resultCode(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> Int64 } protocol PigeonApiProtocolGetTrustResultResponse { } -final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResponse { +final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateGetTrustResultResponse ///An implementation of [NSObject] used to access callback methods @@ -7145,38 +9686,28 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateGetTrustResultResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateGetTrustResultResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of GetTrustResultResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: GetTrustResultResponse, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: GetTrustResultResponse, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let resultArg = try! pigeonDelegate.result(pigeonApi: self, pigeonInstance: pigeonInstance) - let resultCodeArg = try! pigeonDelegate.resultCode( - pigeonApi: self, pigeonInstance: pigeonInstance) + let resultCodeArg = try! pigeonDelegate.resultCode(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.GetTrustResultResponse.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.GetTrustResultResponse.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, resultArg, resultCodeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -7194,32 +9725,105 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `GetTrustResultResponse`. +/// +/// 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 GetTrustResultResponseProxyAPIDelegate : PigeonApiDelegateGetTrustResultResponse { + func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType { + switch pigeonInstance.result { + case .unspecified: + return .unspecified + case .proceed: + return .proceed + case .deny: + return .deny + case .recoverableTrustFailure: + return .recoverableTrustFailure + case .fatalTrustFailure: + return .fatalTrustFailure + case .otherError: + return .otherError + case .invalid: + return .invalid + case .confirm: + return .confirm + @unknown default: + return .unknown + } + } + + func resultCode(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> Int64 { + return pigeonInstance.resultCode + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class GetTrustResultResponseProxyAPITests: XCTestCase { + func testResult() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiGetTrustResultResponse(registrar) + + let instance = TestGetTrustResultResponse() + let value = try? api.pigeonDelegate.result(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.result) + } + + func testResultCode() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiGetTrustResultResponse(registrar) + + let instance = TestGetTrustResultResponse() + let value = try? api.pigeonDelegate.resultCode(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.resultCode) + } + +} +*/ + protocol PigeonApiDelegateSecTrust { /// Evaluates trust for the specified certificate and policies. - func evaluateWithError( - pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, - completion: @escaping (Result) -> Void) + func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) /// Returns an opaque cookie containing exceptions to trust policies that will /// allow future evaluations of the current certificate to succeed. - func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws - -> FlutterStandardTypedData? + func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> FlutterStandardTypedData? /// Sets a list of exceptions that should be ignored when the certificate is /// evaluated. - func setExceptions( - pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData? - ) throws -> Bool + func setExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData?) throws -> Bool /// Returns the result code from the most recent trust evaluation. - func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws - -> GetTrustResultResponse + func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> GetTrustResultResponse /// Certificates used to evaluate trust. - func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws - -> [SecCertificateWrapper]? + func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> [SecCertificateWrapper]? } protocol PigeonApiProtocolSecTrust { } -final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { +final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateSecTrust ///An implementation of [NSObject] used to access callback methods @@ -7231,17 +9835,13 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecTrust?) - { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecTrust?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let evaluateWithErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.evaluateWithError", - binaryMessenger: binaryMessenger, codec: codec) + let evaluateWithErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.evaluateWithError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { evaluateWithErrorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7258,9 +9858,7 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { evaluateWithErrorChannel.setMessageHandler(nil) } - let copyExceptionsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyExceptions", - binaryMessenger: binaryMessenger, codec: codec) + let copyExceptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyExceptions", binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyExceptionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7275,17 +9873,14 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { copyExceptionsChannel.setMessageHandler(nil) } - let setExceptionsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.setExceptions", - binaryMessenger: binaryMessenger, codec: codec) + let setExceptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.setExceptions", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setExceptionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let trustArg = args[0] as! SecTrustWrapper let exceptionsArg: FlutterStandardTypedData? = nilOrValue(args[1]) do { - let result = try api.pigeonDelegate.setExceptions( - pigeonApi: api, trust: trustArg, exceptions: exceptionsArg) + let result = try api.pigeonDelegate.setExceptions(pigeonApi: api, trust: trustArg, exceptions: exceptionsArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -7294,9 +9889,7 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { setExceptionsChannel.setMessageHandler(nil) } - let getTrustResultChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.getTrustResult", - binaryMessenger: binaryMessenger, codec: codec) + let getTrustResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.getTrustResult", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getTrustResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7311,9 +9904,7 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { getTrustResultChannel.setMessageHandler(nil) } - let copyCertificateChainChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyCertificateChain", - binaryMessenger: binaryMessenger, codec: codec) + let copyCertificateChainChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyCertificateChain", binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyCertificateChainChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7331,26 +9922,21 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } ///Creates a Dart instance of SecTrust and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: SecTrustWrapper, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: SecTrustWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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.SecTrust.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.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))) @@ -7368,16 +9954,68 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `SecTrust`. +/// +/// 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 SecTrustWrapperProxyAPIDelegate : PigeonApiDelegateSecTrust { + func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) { + return SecTrust.evaluateWithError(trust: trust) + } + + func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> FlutterStandardTypedData? { + return SecTrust.copyExceptions(trust: trust) + } + + func setExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData?) throws -> Bool { + return SecTrust.setExceptions(trust: trust, exceptions: exceptions) + } + + func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> GetTrustResultResponse { + return SecTrust.getTrustResult(trust: trust) + } + + func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> [SecCertificateWrapper]? { + return SecTrust.copyCertificateChain(trust: trust) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class SecTrustWrapperProxyAPITests: XCTestCase { +} +*/ + protocol PigeonApiDelegateSecCertificate { /// Returns a DER representation of a certificate given a certificate object. - func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws - -> FlutterStandardTypedData + func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData } protocol PigeonApiProtocolSecCertificate { } -final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { +final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateSecCertificate ///An implementation of [NSObject] used to access callback methods @@ -7385,24 +10023,17 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateSecCertificate - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateSecCertificate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecCertificate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecCertificate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let copyDataChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.copyData", - binaryMessenger: binaryMessenger, codec: codec) + let copyDataChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.copyData", binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyDataChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7420,26 +10051,21 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { } ///Creates a Dart instance of SecCertificate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: SecCertificateWrapper, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: SecCertificateWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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.SecCertificate.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.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))) @@ -7457,3 +10083,40 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `SecCertificate`. +/// +/// 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 SecCertificateWrapperProxyAPIDelegate : PigeonApiDelegateSecCertificate { + func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData { + return SecCertificate.copyData(certificate: certificate) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class SecCertificateWrapperProxyAPITests: XCTestCase { +} +*/ + 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 c6a9598d1e0a..8978c9f471c5 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 @@ -8,8 +8,7 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' - show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -20,8 +19,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -30,7 +28,6 @@ List wrapResponse( } return [error.code, error.message, error.details]; } - /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -113,10 +110,9 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> - _weakInstances = >{}; - final Map _strongInstances = - {}; + final Map> _weakInstances = + >{}; + final Map _strongInstances = {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -126,8 +122,7 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = - _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -135,76 +130,42 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.setUpMessageHandlers( - instanceManager: instanceManager); - URLRequest.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - HTTPURLResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - URLResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKUserScript.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKNavigationAction.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKNavigationResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKFrameInfo.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - NSError.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKScriptMessage.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKSecurityOrigin.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - HTTPCookie.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AuthenticationChallengeResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKWebsiteDataStore.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + _PigeonInternalInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); + URLRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + HTTPURLResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + URLResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKUserScript.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKNavigationAction.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKNavigationResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKFrameInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + NSError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKScriptMessage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKSecurityOrigin.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + HTTPCookie.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AuthenticationChallengeResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebsiteDataStore.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); UIView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIScrollView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKWebViewConfiguration.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKUserContentController.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKPreferences.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKScriptMessageHandler.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKNavigationDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - NSObject.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - UIViewWKWebView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - NSViewWKWebView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKWebView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKUIDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKHTTPCookieStore.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - UIScrollViewDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - URLCredential.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - URLProtectionSpace.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - URLAuthenticationChallenge.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + UIScrollView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebViewConfiguration.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKUserContentController.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKPreferences.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKScriptMessageHandler.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKNavigationDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + NSObject.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + UIViewWKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + NSViewWKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKUIDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKHTTPCookieStore.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + UIScrollViewDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + URLCredential.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + URLProtectionSpace.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + URLAuthenticationChallenge.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); URL.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebpagePreferences.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - GetTrustResultResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - SecTrust.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - SecCertificate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + WKWebpagePreferences.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + GetTrustResultResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + SecTrust.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + SecCertificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); return instanceManager; } @@ -268,20 +229,15 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference( - int identifier) { - final PigeonInternalProxyApiBaseClass? weakInstance = - _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference(int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = - _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = - strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass copy = strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = - WeakReference(copy); + _weakInstances[identifier] = WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -305,20 +261,17 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = - WeakReference(instance); + _weakInstances[identifier] = WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); @@ -445,30 +398,294 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } + const _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } +} - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } +/// Handles constructing objects and calling static methods for the Android +/// Interactive Media Ads native library. +/// +/// This class provides dependency injection for the implementations of the +/// platform interface classes. Improving the ease of unit testing and/or +/// overriding the underlying Android classes. +/// +/// By default each function calls the default constructor of the class it +/// intends to return. +class WebKitGProxy { + /// Constructs an [WebKitGProxy]. + const WebKitGProxy({ + this.newURLRequest = URLRequest.new, + this.newWKUserScript = WKUserScript.new, + this.newHTTPCookie = HTTPCookie.new, + this.newAuthenticationChallengeResponse = + AuthenticationChallengeResponse.new, + this.newWKWebViewConfiguration = WKWebViewConfiguration.new, + this.newWKScriptMessageHandler = WKScriptMessageHandler.new, + this.newWKNavigationDelegate = WKNavigationDelegate.new, + this.newNSObject = NSObject.new, + this.newUIViewWKWebView = UIViewWKWebView.new, + this.newNSViewWKWebView = NSViewWKWebView.new, + this.newWKUIDelegate = WKUIDelegate.new, + this.newUIScrollViewDelegate = UIScrollViewDelegate.new, + this.withUserURLCredential = URLCredential.withUser, + this.evaluateWithErrorSecTrust = SecTrust.evaluateWithError, + this.copyExceptionsSecTrust = SecTrust.copyExceptions, + this.setExceptionsSecTrust = SecTrust.setExceptions, + this.getTrustResultSecTrust = SecTrust.getTrustResult, + this.copyCertificateChainSecTrust = SecTrust.copyCertificateChain, + this.copyDataSecCertificate = SecCertificate.copyData, + this.defaultDataStoreWKWebsiteDataStore = + _defaultDataStoreWKWebsiteDataStore, + }); + + /// Constructs [URLRequest]. + final URLRequest Function({ + required String url, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newURLRequest; + + /// Constructs [WKUserScript]. + final WKUserScript Function({ + required String source, + required UserScriptInjectionTime injectionTime, + required bool isForMainFrameOnly, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKUserScript; + + /// Constructs [HTTPCookie]. + final HTTPCookie Function({ + required Map properties, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newHTTPCookie; + + /// Constructs [AuthenticationChallengeResponse]. + final AuthenticationChallengeResponse Function({ + required UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newAuthenticationChallengeResponse; + + /// Constructs [WKWebViewConfiguration]. + final WKWebViewConfiguration Function({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKWebViewConfiguration; + + /// Constructs [WKScriptMessageHandler]. + final WKScriptMessageHandler Function({ + required void Function( + WKScriptMessageHandler, + WKUserContentController, + WKScriptMessage, + ) didReceiveScriptMessage, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKScriptMessageHandler; + + /// Constructs [WKNavigationDelegate]. + final WKNavigationDelegate Function({ + required Future Function( + WKNavigationDelegate, + WKWebView, + WKNavigationAction, + ) decidePolicyForNavigationAction, + required Future Function( + WKNavigationDelegate, + WKWebView, + WKNavigationResponse, + ) decidePolicyForNavigationResponse, + required Future> Function( + WKNavigationDelegate, + WKWebView, + URLAuthenticationChallenge, + ) didReceiveAuthenticationChallenge, + void Function( + WKNavigationDelegate, + WKWebView, + String?, + )? didFinishNavigation, + void Function( + WKNavigationDelegate, + WKWebView, + String?, + )? didStartProvisionalNavigation, + void Function( + WKNavigationDelegate, + WKWebView, + NSError, + )? didFailNavigation, + void Function( + WKNavigationDelegate, + WKWebView, + NSError, + )? didFailProvisionalNavigation, + void Function( + WKNavigationDelegate, + WKWebView, + )? webViewWebContentProcessDidTerminate, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKNavigationDelegate; + + /// Constructs [NSObject]. + final NSObject Function({ + void Function( + NSObject, + String?, + NSObject?, + Map?, + )? observeValue, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newNSObject; + + /// Constructs [UIViewWKWebView]. + final UIViewWKWebView Function({ + required WKWebViewConfiguration initialConfiguration, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newUIViewWKWebView; + + /// Constructs [NSViewWKWebView]. + final NSViewWKWebView Function({ + required WKWebViewConfiguration initialConfiguration, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newNSViewWKWebView; + + /// Constructs [WKUIDelegate]. + final WKUIDelegate Function({ + required Future Function( + WKUIDelegate, + WKWebView, + WKSecurityOrigin, + WKFrameInfo, + MediaCaptureType, + ) requestMediaCapturePermission, + required Future Function( + WKUIDelegate, + WKWebView, + String, + WKFrameInfo, + ) runJavaScriptConfirmPanel, + void Function( + WKUIDelegate, + WKWebView, + WKWebViewConfiguration, + WKNavigationAction, + )? onCreateWebView, + Future Function( + WKUIDelegate, + WKWebView, + String, + WKFrameInfo, + )? runJavaScriptAlertPanel, + Future Function( + WKUIDelegate, + WKWebView, + String, + String?, + WKFrameInfo, + )? runJavaScriptTextInputPanel, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKUIDelegate; + + /// Constructs [UIScrollViewDelegate]. + final UIScrollViewDelegate Function({ + void Function( + UIScrollViewDelegate, + UIScrollView, + double, + double, + )? scrollViewDidScroll, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newUIScrollViewDelegate; + + /// Constructs [URLCredential]. + final URLCredential Function({ + required String user, + required String password, + required UrlCredentialPersistence persistence, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) withUserURLCredential; + + /// Calls to [SecTrust.evaluateWithError]. + final Future Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) evaluateWithErrorSecTrust; + + /// Calls to [SecTrust.copyExceptions]. + final Future Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) copyExceptionsSecTrust; + + /// Calls to [SecTrust.setExceptions]. + final Future Function( + SecTrust, + Uint8List?, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) setExceptionsSecTrust; + + /// Calls to [SecTrust.getTrustResult]. + final Future Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) getTrustResultSecTrust; + + /// Calls to [SecTrust.copyCertificateChain]. + final Future?> Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) copyCertificateChainSecTrust; + + /// Calls to [SecCertificate.copyData]. + final Future Function( + SecCertificate, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) copyDataSecCertificate; + + /// Calls to [WKWebsiteDataStore.defaultDataStore]. + final WKWebsiteDataStore Function() defaultDataStoreWKWebsiteDataStore; + + static WKWebsiteDataStore _defaultDataStoreWKWebsiteDataStore() => + WKWebsiteDataStore.defaultDataStore; } + /// The values that can be returned in a change dictionary. /// /// See https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions. @@ -476,15 +693,12 @@ enum KeyValueObservingOptions { /// Indicates that the change dictionary should provide the new attribute /// value, if applicable. newValue, - /// Indicates that the change dictionary should contain the old attribute /// value, if applicable. oldValue, - /// If specified, a notification should be sent to the observer immediately, /// before the observer registration method even returns. initialValue, - /// Whether separate notifications should be sent to the observer before and /// after each change, instead of a single notification after the change. priorNotification, @@ -496,19 +710,15 @@ enum KeyValueObservingOptions { enum KeyValueChange { /// Indicates that the value of the observed key path was set to a new value. setting, - /// Indicates that an object has been inserted into the to-many relationship /// that is being observed. insertion, - /// Indicates that an object has been removed from the to-many relationship /// that is being observed. removal, - /// Indicates that an object has been replaced in the to-many relationship /// that is being observed. replacement, - /// The value is not recognized by the wrapper. unknown, } @@ -522,28 +732,23 @@ enum KeyValueChangeKey { /// `KeyValueChange.replacement`, the value of this key is a Set object that /// contains the indexes of the inserted, removed, or replaced objects. indexes, - /// An object that contains a value corresponding to one of the /// `KeyValueChange` enum, indicating what sort of change has occurred. kind, - /// If the value of the `KeyValueChange.kind` entry is /// `KeyValueChange.setting, and `KeyValueObservingOptions.newValue` was /// specified when the observer was registered, the value of this key is the /// new value for the attribute. newValue, - /// If the `KeyValueObservingOptions.priorNotification` option was specified /// when the observer was registered this notification is sent prior to a /// change. notificationIsPrior, - /// If the value of the `KeyValueChange.kind` entry is /// `KeyValueChange.setting`, and `KeyValueObservingOptions.old` was specified /// when the observer was registered, the value of this key is the value /// before the attribute was changed. oldValue, - /// The value is not recognized by the wrapper. unknown, } @@ -555,11 +760,9 @@ enum UserScriptInjectionTime { /// A constant to inject the script after the creation of the webpage’s /// document element, but before loading any other content. atDocumentStart, - /// A constant to inject the script after the document finishes loading, but /// before loading any other subresources. atDocumentEnd, - /// The value is not recognized by the wrapper. unknown, } @@ -570,13 +773,10 @@ enum UserScriptInjectionTime { enum AudiovisualMediaType { /// No media types require a user gesture to begin playing. none, - /// Media types that contain audio require a user gesture to begin playing. audio, - /// Media types that contain video require a user gesture to begin playing. video, - /// All media types require a user gesture to begin playing. all, } @@ -588,25 +788,18 @@ enum AudiovisualMediaType { enum WebsiteDataType { /// Cookies. cookies, - /// In-memory caches. memoryCache, - /// On-disk caches. diskCache, - /// HTML offline web app caches. offlineWebApplicationCache, - /// HTML local storage. localStorage, - /// HTML session storage. sessionStorage, - /// WebSQL databases. webSQLDatabases, - /// IndexedDB databases. indexedDBDatabases, } @@ -618,10 +811,8 @@ enum WebsiteDataType { enum NavigationActionPolicy { /// Allow the navigation to continue. allow, - /// Cancel the navigation. cancel, - /// Allow the download to proceed. download, } @@ -633,10 +824,8 @@ enum NavigationActionPolicy { enum NavigationResponsePolicy { /// Allow the navigation to continue. allow, - /// Cancel the navigation. cancel, - /// Allow the download to proceed. download, } @@ -647,51 +836,37 @@ enum NavigationResponsePolicy { enum HttpCookiePropertyKey { /// A String object containing the comment for the cookie. comment, - /// An Uri object or String object containing the comment URL for the cookie. commentUrl, - /// Aa String object stating whether the cookie should be discarded at the end /// of the session. discard, - /// An String object containing the domain for the cookie. domain, - /// An Date object or String object specifying the expiration date for the /// cookie. expires, - /// An String object containing an integer value stating how long in seconds /// the cookie should be kept, at most. maximumAge, - /// An String object containing the name of the cookie (required). name, - /// A URL or String object containing the URL that set this cookie. originUrl, - /// A String object containing the path for the cookie. path, - /// An String object containing comma-separated integer values specifying the /// ports for the cookie. port, - /// A string indicating the same-site policy for the cookie. sameSitePolicy, - /// A String object indicating that the cookie should be transmitted only over /// secure channels. secure, - /// A String object containing the value of the cookie. value, - /// A String object that specifies the version of the cookie. version, - /// The value is not recognized by the wrapper. unknown, } @@ -702,22 +877,16 @@ enum HttpCookiePropertyKey { enum NavigationType { /// A link activation. linkActivated, - /// A request to submit a form. formSubmitted, - /// A request for the frame’s next or previous item. backForward, - /// A request to reload the webpage. reload, - /// A request to resubmit a form. formResubmitted, - /// A navigation request that originates for some other reason. other, - /// The value is not recognized by the wrapper. unknown, } @@ -728,10 +897,8 @@ enum NavigationType { enum PermissionDecision { /// Deny permission for the requested resource. deny, - /// Deny permission for the requested resource. grant, - /// Prompt the user for permission for the requested resource. prompt, } @@ -742,13 +909,10 @@ enum PermissionDecision { enum MediaCaptureType { /// A media device that can capture video. camera, - /// A media device or devices that can capture audio and video. cameraAndMicrophone, - /// A media device that can capture audio. microphone, - /// The value is not recognized by the wrapper. unknown, } @@ -759,18 +923,14 @@ enum MediaCaptureType { enum UrlSessionAuthChallengeDisposition { /// Use the specified credential, which may be nil. useCredential, - /// Use the default handling for the challenge as though this delegate method /// were not implemented. performDefaultHandling, - /// Cancel the entire request. cancelAuthenticationChallenge, - /// Reject this challenge, and call the authentication delegate method again /// with the next authentication protection space. rejectProtectionSpace, - /// The value is not recognized by the wrapper. unknown, } @@ -781,13 +941,10 @@ enum UrlSessionAuthChallengeDisposition { enum UrlCredentialPersistence { /// The credential should not be stored. none, - /// The credential should be stored only for this session. forSession, - /// The credential should be stored in the keychain. permanent, - /// The credential should be stored permanently in the keychain, and in /// addition should be distributed to other devices based on the owning Apple /// ID. @@ -800,33 +957,26 @@ enum UrlCredentialPersistence { enum DartSecTrustResultType { /// The user did not specify a trust setting. unspecified, - /// The user granted permission to trust the certificate for the purposes /// designated in the specified policies. proceed, - /// The user specified that the certificate should not be trusted. deny, - /// Trust is denied, but recovery may be possible. recoverableTrustFailure, - /// Trust is denied and no simple fix is available. fatalTrustFailure, - /// A value that indicates a failure other than trust evaluation. otherError, - /// An indication of an invalid setting or result. invalid, - /// User confirmation is required before proceeding. confirm, - /// The type is not recognized by this wrapper. unknown, } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -834,49 +984,49 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is KeyValueObservingOptions) { + } else if (value is KeyValueObservingOptions) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is KeyValueChange) { + } else if (value is KeyValueChange) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is KeyValueChangeKey) { + } else if (value is KeyValueChangeKey) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is UserScriptInjectionTime) { + } else if (value is UserScriptInjectionTime) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is AudiovisualMediaType) { + } else if (value is AudiovisualMediaType) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is WebsiteDataType) { + } else if (value is WebsiteDataType) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is NavigationActionPolicy) { + } else if (value is NavigationActionPolicy) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is NavigationResponsePolicy) { + } else if (value is NavigationResponsePolicy) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is HttpCookiePropertyKey) { + } else if (value is HttpCookiePropertyKey) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is NavigationType) { + } else if (value is NavigationType) { buffer.putUint8(138); writeValue(buffer, value.index); - } else if (value is PermissionDecision) { + } else if (value is PermissionDecision) { buffer.putUint8(139); writeValue(buffer, value.index); - } else if (value is MediaCaptureType) { + } else if (value is MediaCaptureType) { buffer.putUint8(140); writeValue(buffer, value.index); - } else if (value is UrlSessionAuthChallengeDisposition) { + } else if (value is UrlSessionAuthChallengeDisposition) { buffer.putUint8(141); writeValue(buffer, value.index); - } else if (value is UrlCredentialPersistence) { + } else if (value is UrlCredentialPersistence) { buffer.putUint8(142); writeValue(buffer, value.index); - } else if (value is DartSecTrustResultType) { + } else if (value is DartSecTrustResultType) { buffer.putUint8(143); writeValue(buffer, value.index); } else { @@ -887,51 +1037,49 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueObservingOptions.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChange.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChangeKey.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : UserScriptInjectionTime.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : AudiovisualMediaType.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : WebsiteDataType.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationActionPolicy.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationResponsePolicy.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : HttpCookiePropertyKey.values[value]; - case 138: + case 138: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationType.values[value]; - case 139: + case 139: final int? value = readValue(buffer) as int?; return value == null ? null : PermissionDecision.values[value]; - case 140: + case 140: final int? value = readValue(buffer) as int?; return value == null ? null : MediaCaptureType.values[value]; - case 141: + case 141: final int? value = readValue(buffer) as int?; - return value == null - ? null - : UrlSessionAuthChallengeDisposition.values[value]; - case 142: + return value == null ? null : UrlSessionAuthChallengeDisposition.values[value]; + case 142: final int? value = readValue(buffer) as int?; return value == null ? null : UrlCredentialPersistence.values[value]; - case 143: + case 143: final int? value = readValue(buffer) as int?; return value == null ? null : DartSecTrustResultType.values[value]; default: @@ -939,7 +1087,6 @@ class _PigeonCodec extends StandardMessageCodec { } } } - /// A URL load request that is independent of protocol or URL scheme. /// /// See https://developer.apple.com/documentation/foundation/urlrequest. @@ -8595,3 +8742,4 @@ class SecCertificate extends NSObject { ); } } + 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 a9ecf777fefc..f4a570a34217 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 @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'dart:typed_data'; + import 'common/platform_webview.dart'; import 'common/web_kit.g.dart'; @@ -30,6 +32,12 @@ class WebKitProxy { this.newWKUIDelegate = WKUIDelegate.new, this.newUIScrollViewDelegate = UIScrollViewDelegate.new, this.withUserURLCredential = URLCredential.withUser, + this.evaluateWithErrorSecTrust = SecTrust.evaluateWithError, + this.copyExceptionsSecTrust = SecTrust.copyExceptions, + this.setExceptionsSecTrust = SecTrust.setExceptions, + this.getTrustResultSecTrust = SecTrust.getTrustResult, + this.copyCertificateChainSecTrust = SecTrust.copyCertificateChain, + this.copyDataSecCertificate = SecCertificate.copyData, this.defaultDataStoreWKWebsiteDataStore = _defaultDataStoreWKWebsiteDataStore, }); @@ -182,6 +190,26 @@ class WebKitProxy { required UrlCredentialPersistence persistence, }) withUserURLCredential; + /// Calls to [SecTrust.evaluateWithError]. + final Future Function(SecTrust) evaluateWithErrorSecTrust; + + /// Calls to [SecTrust.copyExceptions]. + final Future Function(SecTrust) copyExceptionsSecTrust; + + /// Calls to [SecTrust.setExceptions]. + final Future Function(SecTrust, Uint8List?) setExceptionsSecTrust; + + /// Calls to [SecTrust.getTrustResult]. + final Future Function(SecTrust) + getTrustResultSecTrust; + + /// Calls to [SecTrust.copyCertificateChain]. + final Future?> Function(SecTrust) + copyCertificateChainSecTrust; + + /// Calls to [SecCertificate.copyData]. + final Future Function(SecCertificate) copyDataSecCertificate; + /// Calls to [WKWebsiteDataStore.defaultDataStore]. final WKWebsiteDataStore Function() defaultDataStoreWKWebsiteDataStore; diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index e4ade0e83249..f69ef53c0850 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -32,7 +32,11 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^25.2.0 + pigeon: + git: + url: git@github.com:bparrishMines/packages.git + ref: pigeon_helper + path: packages/pigeon topics: - html From 6a7a4db4f7a65deb136cd71d970ed0520b4e2fd5 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 22:30:44 -0400 Subject: [PATCH 21/34] add webkit unit test --- .../lib/src/webkit_ssl_auth_error.dart | 8 +- .../lib/src/webkit_webview_controller.dart | 9 +- .../lib/webview_flutter_wkwebview.dart | 1 + .../web_kit_cookie_manager_test.mocks.dart | 163 +- .../web_kit_webview_widget_test.mocks.dart | 1801 ++++++++------- .../test/webkit_navigation_delegate_test.dart | 146 +- ...webkit_navigation_delegate_test.mocks.dart | 335 ++- .../webkit_webview_controller_test.mocks.dart | 1946 +++++++++-------- ...kit_webview_cookie_manager_test.mocks.dart | 163 +- .../webkit_webview_widget_test.mocks.dart | 361 +-- 10 files changed, 2835 insertions(+), 2098 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart index ca86f86b8eba..4a07c7b10dbb 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart @@ -5,6 +5,7 @@ import 'package:flutter/services.dart'; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'common/web_kit.g.dart'; +import 'webkit_proxy.dart'; class WebKitSslAuthError extends PlatformSslAuthError { WebKitSslAuthError({ @@ -13,14 +14,17 @@ class WebKitSslAuthError extends PlatformSslAuthError { required SecTrust trust, required this.host, required this.port, + required WebKitProxy proxy, required void Function( UrlSessionAuthChallengeDisposition disposition, Map? credentialMap, ) onResponse, }) : _trust = trust, + _proxy = proxy, _onResponse = onResponse; final SecTrust _trust; + final WebKitProxy _proxy; final void Function( UrlSessionAuthChallengeDisposition disposition, @@ -43,9 +47,9 @@ class WebKitSslAuthError extends PlatformSslAuthError { @override Future proceed() async { - final Uint8List? exceptions = await SecTrust.copyExceptions(_trust); + final Uint8List? exceptions = await _proxy.copyExceptionsSecTrust(_trust); if (exceptions != null) { - await SecTrust.setExceptions(_trust, exceptions); + await _proxy.setExceptionsSecTrust(_trust, exceptions); } _onResponse( UrlSessionAuthChallengeDisposition.useCredential, 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 5b271b490870..88ab3b6ec9d1 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 @@ -1296,7 +1296,7 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { try { final bool trusted = - await SecTrust.evaluateWithError(serverTrust); + await proxy.evaluateWithErrorSecTrust(serverTrust); if (!trusted) { throw StateError( 'Expected to throw an exception when evaluation fails.', @@ -1304,10 +1304,10 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { } } on PlatformException catch (exception) { final DartSecTrustResultType result = - (await SecTrust.getTrustResult(serverTrust)).result; + (await proxy.getTrustResultSecTrust(serverTrust)).result; if (result == DartSecTrustResultType.recoverableTrustFailure) { final List certificates = - (await SecTrust.copyCertificateChain(serverTrust)) ?? + (await proxy.copyCertificateChainSecTrust(serverTrust)) ?? []; final SecCertificate? leafCertificate = @@ -1316,7 +1316,7 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { WebKitSslAuthError( certificate: leafCertificate != null ? X509Certificate( - data: await SecCertificate.copyData( + data: await proxy.copyDataSecCertificate( leafCertificate, ), ) @@ -1325,6 +1325,7 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { trust: serverTrust, host: protectionSpace.host, port: protectionSpace.port, + proxy: proxy, onResponse: ( UrlSessionAuthChallengeDisposition disposition, Map? credentialMap, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/webview_flutter_wkwebview.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/webview_flutter_wkwebview.dart index 01dbb61babe8..9eba1513d3c3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/webview_flutter_wkwebview.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/webview_flutter_wkwebview.dart @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +export 'src/webkit_ssl_auth_error.dart'; export 'src/webkit_webview_controller.dart'; export 'src/webkit_webview_cookie_manager.dart'; export 'src/webkit_webview_platform.dart'; 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 4e7d186e80f5..e29d4d71a3fb 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 @@ -25,19 +25,19 @@ 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); + : super(parent, parentInvocation); } class _FakeWKHTTPCookieStore_1 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { _FakeWKHTTPCookieStore_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_2 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [WKHTTPCookieStore]. @@ -49,29 +49,35 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i3.Future setCookie(_i2.HTTPCookie? cookie) => (super.noSuchMethod( - Invocation.method(#setCookie, [cookie]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setCookie(_i2.HTTPCookie? cookie) => + (super.noSuchMethod( + 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, []), - returnValue: _FakeWKHTTPCookieStore_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKHTTPCookieStore_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKHTTPCookieStore); @override _i3.Future addObserver( @@ -80,18 +86,20 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKWebsiteDataStore]. @@ -104,31 +112,37 @@ class MockWKWebsiteDataStore extends _i1.Mock } @override - _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( - Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_1( - this, - Invocation.getter(#httpCookieStore), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore get httpCookieStore => + (super.noSuchMethod( + Invocation.getter(#httpCookieStore), + returnValue: _FakeWKHTTPCookieStore_1( + this, + Invocation.getter(#httpCookieStore), + ), + ) + as _i2.WKHTTPCookieStore); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_1( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => + (super.noSuchMethod( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_1( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + ) + as _i2.WKHTTPCookieStore); @override _i3.Future removeDataOfTypes( @@ -136,21 +150,24 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method(#removeDataOfTypes, [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ]), - returnValue: _i3.Future.value(false), - ) as _i3.Future); + Invocation.method(#removeDataOfTypes, [ + dataTypes, + modificationTimeInSecondsSinceEpoch, + ]), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); @override - _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebsiteDataStore_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebsiteDataStore); + _i2.WKWebsiteDataStore pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebsiteDataStore); @override _i3.Future addObserver( @@ -159,16 +176,18 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + 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.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart index 88df3f478fc5..678af5683fe2 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 @@ -36,86 +36,86 @@ 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); + : super(parent, parentInvocation); } class _FakeUIScrollView_1 extends _i1.SmartFake implements _i2.UIScrollView { _FakeUIScrollView_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURLRequest_2 extends _i1.SmartFake implements _i2.URLRequest { _FakeURLRequest_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKNavigationDelegate_3 extends _i1.SmartFake implements _i2.WKNavigationDelegate { _FakeWKNavigationDelegate_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKPreferences_4 extends _i1.SmartFake implements _i2.WKPreferences { _FakeWKPreferences_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKScriptMessageHandler_5 extends _i1.SmartFake implements _i2.WKScriptMessageHandler { _FakeWKScriptMessageHandler_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebView_6 extends _i1.SmartFake implements _i2.WKWebView { _FakeWKWebView_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebViewConfiguration_7 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { _FakeWKWebViewConfiguration_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeUIViewWKWebView_8 extends _i1.SmartFake implements _i2.UIViewWKWebView { _FakeUIViewWKWebView_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUserContentController_9 extends _i1.SmartFake implements _i2.WKUserContentController { _FakeWKUserContentController_9(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_10 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_10(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebpagePreferences_11 extends _i1.SmartFake implements _i2.WKWebpagePreferences { _FakeWKWebpagePreferences_11(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKHTTPCookieStore_12 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { _FakeWKHTTPCookieStore_12(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUIDelegate_13 extends _i1.SmartFake implements _i2.WKUIDelegate { _FakeWKUIDelegate_13(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakePlatformWebView_14 extends _i1.SmartFake implements _i3.PlatformWebView { _FakePlatformWebView_14(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [UIScrollView]. @@ -127,101 +127,124 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i4.Future> getContentOffset() => (super.noSuchMethod( - Invocation.method(#getContentOffset, []), - returnValue: _i4.Future>.value([]), - ) as _i4.Future>); + _i4.Future> getContentOffset() => + (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _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) => (super.noSuchMethod( - Invocation.method(#setContentOffset, [x, y]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setContentOffset, [x, y]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future setDelegate(_i2.UIScrollViewDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setDelegate, [delegate]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + _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); + _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); + _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); + _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); + 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, []), - returnValue: _FakeUIScrollView_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.UIScrollView); + _i2.UIScrollView pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollView_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.UIScrollView); @override - _i4.Future setBackgroundColor(int? value) => (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [value]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setBackgroundColor(int? value) => + (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setOpaque(bool? opaque) => + (super.noSuchMethod( + Invocation.method(#setOpaque, [opaque]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future addObserver( @@ -230,18 +253,20 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [URLRequest]. @@ -253,69 +278,85 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i4.Future getUrl() => (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i4.Future.value(), - ) as _i4.Future); + _i4.Future getUrl() => + (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future setHttpMethod(String? method) => (super.noSuchMethod( - Invocation.method(#setHttpMethod, [method]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setHttpMethod(String? method) => + (super.noSuchMethod( + Invocation.method(#setHttpMethod, [method]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future getHttpMethod() => (super.noSuchMethod( - Invocation.method(#getHttpMethod, []), - returnValue: _i4.Future.value(), - ) as _i4.Future); + _i4.Future getHttpMethod() => + (super.noSuchMethod( + Invocation.method(#getHttpMethod, []), + returnValue: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future setHttpBody(_i5.Uint8List? body) => (super.noSuchMethod( - Invocation.method(#setHttpBody, [body]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setHttpBody(_i5.Uint8List? body) => + (super.noSuchMethod( + 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, []), - returnValue: _i4.Future<_i5.Uint8List?>.value(), - ) as _i4.Future<_i5.Uint8List?>); + _i4.Future<_i5.Uint8List?> getHttpBody() => + (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setAllHttpHeaderFields, [fields]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method(#getAllHttpHeaderFields, []), - returnValue: _i4.Future?>.value(), - ) as _i4.Future?>); + Invocation.method(#getAllHttpHeaderFields, []), + returnValue: _i4.Future?>.value(), + ) + as _i4.Future?>); @override - _i2.URLRequest pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeURLRequest_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.URLRequest); + _i2.URLRequest pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLRequest_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.URLRequest); @override _i4.Future addObserver( @@ -324,18 +365,20 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WKNavigationDelegate]. @@ -352,79 +395,92 @@ class MockWKNavigationDelegate extends _i1.Mock _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, - )); + ) + 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, - )); + ) + 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> 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>.value([]), - ) as _i4.Future> Function( - _i2.WKNavigationDelegate, - _i2.WKWebView, - _i2.URLAuthenticationChallenge, - )); - - @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); - - @override - _i2.WKNavigationDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKNavigationDelegate_3( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKNavigationDelegate); + ) + get didReceiveAuthenticationChallenge => + (super.noSuchMethod( + Invocation.getter(#didReceiveAuthenticationChallenge), + returnValue: + ( + _i2.WKNavigationDelegate pigeon_instance, + _i2.WKWebView webView, + _i2.URLAuthenticationChallenge challenge, + ) => _i4.Future>.value([]), + ) + as _i4.Future> Function( + _i2.WKNavigationDelegate, + _i2.WKWebView, + _i2.URLAuthenticationChallenge, + )); + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); + + @override + _i2.WKNavigationDelegate pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKNavigationDelegate_3( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKNavigationDelegate); @override _i4.Future addObserver( @@ -433,18 +489,20 @@ class MockWKNavigationDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WKPreferences]. @@ -456,29 +514,35 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i4.Future setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod( - Invocation.method(#setJavaScriptEnabled, [enabled]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setJavaScriptEnabled(bool? enabled) => + (super.noSuchMethod( + 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( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKPreferences); + _i2.WKPreferences pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKPreferences_4( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKPreferences); @override _i4.Future addObserver( @@ -487,18 +551,20 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WKScriptMessageHandler]. @@ -515,36 +581,44 @@ class MockWKScriptMessageHandler extends _i1.Mock _i2.WKScriptMessageHandler, _i2.WKUserContentController, _i2.WKScriptMessage, - ) get didReceiveScriptMessage => (super.noSuchMethod( - Invocation.getter(#didReceiveScriptMessage), - returnValue: ( - _i2.WKScriptMessageHandler pigeon_instance, - _i2.WKUserContentController controller, - _i2.WKScriptMessage message, - ) {}, - ) as void Function( - _i2.WKScriptMessageHandler, - _i2.WKUserContentController, - _i2.WKScriptMessage, - )); - - @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); - - @override - _i2.WKScriptMessageHandler pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKScriptMessageHandler_5( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKScriptMessageHandler); + ) + get didReceiveScriptMessage => + (super.noSuchMethod( + Invocation.getter(#didReceiveScriptMessage), + returnValue: + ( + _i2.WKScriptMessageHandler pigeon_instance, + _i2.WKUserContentController controller, + _i2.WKScriptMessage message, + ) {}, + ) + as void Function( + _i2.WKScriptMessageHandler, + _i2.WKUserContentController, + _i2.WKScriptMessage, + )); + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); + + @override + _i2.WKScriptMessageHandler pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKScriptMessageHandler_5( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKScriptMessageHandler); @override _i4.Future addObserver( @@ -553,18 +627,20 @@ class MockWKScriptMessageHandler extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WKWebView]. @@ -576,22 +652,26 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i2.WKWebView pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebView_6( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebView); + _i2.WKWebView pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebView_6( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebView); @override _i4.Future addObserver( @@ -600,18 +680,20 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [UIViewWKWebView]. @@ -623,211 +705,261 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { } @override - _i2.WKWebViewConfiguration get configuration => (super.noSuchMethod( - Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_7( - this, - Invocation.getter(#configuration), - ), - ) as _i2.WKWebViewConfiguration); + _i2.WKWebViewConfiguration get configuration => + (super.noSuchMethod( + Invocation.getter(#configuration), + returnValue: _FakeWKWebViewConfiguration_7( + this, + Invocation.getter(#configuration), + ), + ) + as _i2.WKWebViewConfiguration); @override - _i2.UIScrollView get scrollView => (super.noSuchMethod( - Invocation.getter(#scrollView), - returnValue: _FakeUIScrollView_1( - this, - Invocation.getter(#scrollView), - ), - ) as _i2.UIScrollView); + _i2.UIScrollView get scrollView => + (super.noSuchMethod( + Invocation.getter(#scrollView), + returnValue: _FakeUIScrollView_1( + this, + Invocation.getter(#scrollView), + ), + ) + as _i2.UIScrollView); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i2.WKWebViewConfiguration pigeonVar_configuration() => (super.noSuchMethod( - Invocation.method(#pigeonVar_configuration, []), - returnValue: _FakeWKWebViewConfiguration_7( - this, - Invocation.method(#pigeonVar_configuration, []), - ), - ) as _i2.WKWebViewConfiguration); + _i2.WKWebViewConfiguration pigeonVar_configuration() => + (super.noSuchMethod( + Invocation.method(#pigeonVar_configuration, []), + returnValue: _FakeWKWebViewConfiguration_7( + this, + Invocation.method(#pigeonVar_configuration, []), + ), + ) + as _i2.WKWebViewConfiguration); @override - _i2.UIScrollView pigeonVar_scrollView() => (super.noSuchMethod( - Invocation.method(#pigeonVar_scrollView, []), - returnValue: _FakeUIScrollView_1( - this, - Invocation.method(#pigeonVar_scrollView, []), - ), - ) as _i2.UIScrollView); + _i2.UIScrollView pigeonVar_scrollView() => + (super.noSuchMethod( + Invocation.method(#pigeonVar_scrollView, []), + returnValue: _FakeUIScrollView_1( + this, + Invocation.method(#pigeonVar_scrollView, []), + ), + ) + as _i2.UIScrollView); @override _i4.Future setUIDelegate(_i2.WKUIDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setUIDelegate, [delegate]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setUIDelegate, [delegate]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future setNavigationDelegate(_i2.WKNavigationDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setNavigationDelegate, [delegate]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setNavigationDelegate, [delegate]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future getUrl() => (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i4.Future.value(), - ) as _i4.Future); + _i4.Future getUrl() => + (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future getEstimatedProgress() => (super.noSuchMethod( - Invocation.method(#getEstimatedProgress, []), - returnValue: _i4.Future.value(0.0), - ) as _i4.Future); + _i4.Future getEstimatedProgress() => + (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future load(_i2.URLRequest? request) => + (super.noSuchMethod( + Invocation.method(#load, [request]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future loadHtmlString(String? string, String? baseUrl) => (super.noSuchMethod( - Invocation.method(#loadHtmlString, [string, baseUrl]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#loadHtmlString, [string, baseUrl]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future loadFileUrl(String? url, String? readAccessUrl) => (super.noSuchMethod( - Invocation.method(#loadFileUrl, [url, readAccessUrl]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future loadFlutterAsset(String? key) => + (super.noSuchMethod( + Invocation.method(#loadFlutterAsset, [key]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future canGoBack() => (super.noSuchMethod( - Invocation.method(#canGoBack, []), - returnValue: _i4.Future.value(false), - ) as _i4.Future); + _i4.Future canGoBack() => + (super.noSuchMethod( + Invocation.method(#canGoBack, []), + returnValue: _i4.Future.value(false), + ) + as _i4.Future); @override - _i4.Future canGoForward() => (super.noSuchMethod( - Invocation.method(#canGoForward, []), - returnValue: _i4.Future.value(false), - ) as _i4.Future); + _i4.Future canGoForward() => + (super.noSuchMethod( + Invocation.method(#canGoForward, []), + returnValue: _i4.Future.value(false), + ) + as _i4.Future); @override - _i4.Future goBack() => (super.noSuchMethod( - Invocation.method(#goBack, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future goBack() => + (super.noSuchMethod( + Invocation.method(#goBack, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future goForward() => (super.noSuchMethod( - Invocation.method(#goForward, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future goForward() => + (super.noSuchMethod( + Invocation.method(#goForward, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future reload() => (super.noSuchMethod( - Invocation.method(#reload, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future reload() => + (super.noSuchMethod( + Invocation.method(#reload, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future getTitle() => (super.noSuchMethod( - Invocation.method(#getTitle, []), - returnValue: _i4.Future.value(), - ) as _i4.Future); + _i4.Future getTitle() => + (super.noSuchMethod( + Invocation.method(#getTitle, []), + returnValue: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsBackForwardNavigationGestures, [allow]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setCustomUserAgent(String? userAgent) => + (super.noSuchMethod( + Invocation.method(#setCustomUserAgent, [userAgent]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( - Invocation.method(#evaluateJavaScript, [javaScriptString]), - returnValue: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#evaluateJavaScript, [javaScriptString]), + returnValue: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future setInspectable(bool? inspectable) => (super.noSuchMethod( - Invocation.method(#setInspectable, [inspectable]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setInspectable(bool? inspectable) => + (super.noSuchMethod( + Invocation.method(#setInspectable, [inspectable]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future getCustomUserAgent() => (super.noSuchMethod( - Invocation.method(#getCustomUserAgent, []), - returnValue: _i4.Future.value(), - ) as _i4.Future); + _i4.Future getCustomUserAgent() => + (super.noSuchMethod( + Invocation.method(#getCustomUserAgent, []), + returnValue: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future setAllowsLinkPreview(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsLinkPreview, [allow]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setAllowsLinkPreview(bool? allow) => + (super.noSuchMethod( + Invocation.method(#setAllowsLinkPreview, [allow]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i2.UIViewWKWebView pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeUIViewWKWebView_8( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.UIViewWKWebView); + _i2.UIViewWKWebView pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIViewWKWebView_8( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.UIViewWKWebView); @override - _i4.Future setBackgroundColor(int? value) => (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [value]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setBackgroundColor(int? value) => + (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future setOpaque(bool? opaque) => + (super.noSuchMethod( + Invocation.method(#setOpaque, [opaque]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future addObserver( @@ -836,18 +968,20 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WKWebViewConfiguration]. @@ -860,123 +994,138 @@ class MockWKWebViewConfiguration extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override _i4.Future setUserContentController( _i2.WKUserContentController? controller, ) => (super.noSuchMethod( - Invocation.method(#setUserContentController, [controller]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setUserContentController, [controller]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( - Invocation.method(#getUserContentController, []), - returnValue: _i4.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_9( - this, Invocation.method(#getUserContentController, []), - ), - ), - ) as _i4.Future<_i2.WKUserContentController>); + returnValue: _i4.Future<_i2.WKUserContentController>.value( + _FakeWKUserContentController_9( + this, + Invocation.method(#getUserContentController, []), + ), + ), + ) + as _i4.Future<_i2.WKUserContentController>); @override _i4.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method(#setWebsiteDataStore, [dataStore]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setWebsiteDataStore, [dataStore]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( - Invocation.method(#getWebsiteDataStore, []), - returnValue: _i4.Future<_i2.WKWebsiteDataStore>.value( - _FakeWKWebsiteDataStore_10( - this, Invocation.method(#getWebsiteDataStore, []), - ), - ), - ) as _i4.Future<_i2.WKWebsiteDataStore>); + returnValue: _i4.Future<_i2.WKWebsiteDataStore>.value( + _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#getWebsiteDataStore, []), + ), + ), + ) + as _i4.Future<_i2.WKWebsiteDataStore>); @override _i4.Future setPreferences(_i2.WKPreferences? preferences) => (super.noSuchMethod( - Invocation.method(#setPreferences, [preferences]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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, + _i4.Future<_i2.WKPreferences> getPreferences() => + (super.noSuchMethod( Invocation.method(#getPreferences, []), - ), - ), - ) as _i4.Future<_i2.WKPreferences>); + returnValue: _i4.Future<_i2.WKPreferences>.value( + _FakeWKPreferences_4( + this, + Invocation.method(#getPreferences, []), + ), + ), + ) + as _i4.Future<_i2.WKPreferences>); @override _i4.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsInlineMediaPlayback, [allow]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future setMediaTypesRequiringUserActionForPlayback( _i2.AudiovisualMediaType? type, ) => (super.noSuchMethod( - Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ - type, - ]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( - Invocation.method(#getDefaultWebpagePreferences, []), - returnValue: _i4.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, Invocation.method(#getDefaultWebpagePreferences, []), - ), - ), - ) as _i4.Future<_i2.WKWebpagePreferences>); + returnValue: _i4.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_11( + this, + Invocation.method(#getDefaultWebpagePreferences, []), + ), + ), + ) + as _i4.Future<_i2.WKWebpagePreferences>); @override - _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebViewConfiguration_7( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebViewConfiguration); + _i2.WKWebViewConfiguration pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebViewConfiguration_7( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebViewConfiguration); @override _i4.Future addObserver( @@ -985,18 +1134,20 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WKWebsiteDataStore]. @@ -1009,31 +1160,37 @@ class MockWKWebsiteDataStore extends _i1.Mock } @override - _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( - Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_12( - this, - Invocation.getter(#httpCookieStore), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore get httpCookieStore => + (super.noSuchMethod( + Invocation.getter(#httpCookieStore), + returnValue: _FakeWKHTTPCookieStore_12( + this, + Invocation.getter(#httpCookieStore), + ), + ) + as _i2.WKHTTPCookieStore); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_12( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => + (super.noSuchMethod( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_12( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + ) + as _i2.WKHTTPCookieStore); @override _i4.Future removeDataOfTypes( @@ -1041,21 +1198,24 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method(#removeDataOfTypes, [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ]), - returnValue: _i4.Future.value(false), - ) as _i4.Future); + 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( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebsiteDataStore); + _i2.WKWebsiteDataStore pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebsiteDataStore); @override _i4.Future addObserver( @@ -1064,18 +1224,20 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WKUIDelegate]. @@ -1093,25 +1255,28 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { _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, - )); + ) + 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( @@ -1119,39 +1284,46 @@ class MockWKUIDelegate extends _i1.Mock implements _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), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); - - @override - _i2.WKUIDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKUIDelegate_13( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKUIDelegate); + ) + 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), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); + + @override + _i2.WKUIDelegate pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUIDelegate_13( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKUIDelegate); @override _i4.Future addObserver( @@ -1160,18 +1332,20 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WKUserContentController]. @@ -1184,13 +1358,15 @@ class MockWKUserContentController extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override _i4.Future addScriptMessageHandler( @@ -1198,49 +1374,58 @@ class MockWKUserContentController extends _i1.Mock String? name, ) => (super.noSuchMethod( - Invocation.method(#addScriptMessageHandler, [handler, name]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#addScriptMessageHandler, [handler, name]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( - Invocation.method(#removeScriptMessageHandler, [name]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#removeScriptMessageHandler, [name]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( - Invocation.method(#removeAllScriptMessageHandlers, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future removeAllScriptMessageHandlers() => + (super.noSuchMethod( + Invocation.method(#removeAllScriptMessageHandlers, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override _i4.Future addUserScript(_i2.WKUserScript? userScript) => (super.noSuchMethod( - Invocation.method(#addUserScript, [userScript]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + Invocation.method(#addUserScript, [userScript]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); @override - _i4.Future removeAllUserScripts() => (super.noSuchMethod( - Invocation.method(#removeAllUserScripts, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + _i4.Future removeAllUserScripts() => + (super.noSuchMethod( + 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( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKUserContentController); + _i2.WKUserContentController pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUserContentController_9( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKUserContentController); @override _i4.Future addObserver( @@ -1249,18 +1434,20 @@ class MockWKUserContentController extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [JavascriptChannelRegistry]. @@ -1273,10 +1460,12 @@ class MockJavascriptChannelRegistry extends _i1.Mock } @override - Map get channels => (super.noSuchMethod( - Invocation.getter(#channels), - returnValue: {}, - ) as Map); + Map get channels => + (super.noSuchMethod( + Invocation.getter(#channels), + returnValue: {}, + ) + as Map); @override void onJavascriptChannelMessage(String? channel, String? message) => @@ -1308,36 +1497,37 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock required bool? isForMainFrame, }) => (super.noSuchMethod( - Invocation.method(#onNavigationRequest, [], { - #url: url, - #isForMainFrame: isForMainFrame, - }), - returnValue: _i4.Future.value(false), - ) as _i4.FutureOr); + 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]), - returnValueForMissingStub: null, - ); + Invocation.method(#onPageStarted, [url]), + returnValueForMissingStub: null, + ); @override void onPageFinished(String? url) => super.noSuchMethod( - Invocation.method(#onPageFinished, [url]), - returnValueForMissingStub: null, - ); + Invocation.method(#onPageFinished, [url]), + returnValueForMissingStub: null, + ); @override void onProgress(int? progress) => super.noSuchMethod( - Invocation.method(#onProgress, [progress]), - returnValueForMissingStub: null, - ); + Invocation.method(#onProgress, [progress]), + returnValueForMissingStub: null, + ); @override void onWebResourceError(_i8.WebResourceError? error) => super.noSuchMethod( - Invocation.method(#onWebResourceError, [error]), - returnValueForMissingStub: null, - ); + Invocation.method(#onWebResourceError, [error]), + returnValueForMissingStub: null, + ); } /// A class which mocks [WebViewWidgetProxy]. @@ -1353,32 +1543,35 @@ class MockWebViewWidgetProxy extends _i1.Mock _i3.PlatformWebView createWebView( _i2.WKWebViewConfiguration? configuration, { void Function(String, _i2.NSObject, Map<_i2.KeyValueChangeKey, Object?>)? - observeValue, + observeValue, }) => (super.noSuchMethod( - Invocation.method( - #createWebView, - [configuration], - {#observeValue: observeValue}, - ), - returnValue: _FakePlatformWebView_14( - this, - Invocation.method( - #createWebView, - [configuration], - {#observeValue: observeValue}, - ), - ), - ) as _i3.PlatformWebView); - - @override - _i2.URLRequest createRequest({required String? url}) => (super.noSuchMethod( - Invocation.method(#createRequest, [], {#url: url}), - returnValue: _FakeURLRequest_2( - this, - Invocation.method(#createRequest, [], {#url: url}), - ), - ) as _i2.URLRequest); + Invocation.method( + #createWebView, + [configuration], + {#observeValue: observeValue}, + ), + returnValue: _FakePlatformWebView_14( + this, + Invocation.method( + #createWebView, + [configuration], + {#observeValue: observeValue}, + ), + ), + ) + as _i3.PlatformWebView); + + @override + _i2.URLRequest createRequest({required String? url}) => + (super.noSuchMethod( + Invocation.method(#createRequest, [], {#url: url}), + returnValue: _FakeURLRequest_2( + this, + Invocation.method(#createRequest, [], {#url: url}), + ), + ) + as _i2.URLRequest); @override _i2.WKScriptMessageHandler createScriptMessageHandler({ @@ -1386,19 +1579,21 @@ class MockWebViewWidgetProxy extends _i1.Mock _i2.WKScriptMessageHandler, _i2.WKUserContentController, _i2.WKScriptMessage, - )? didReceiveScriptMessage, + )? + didReceiveScriptMessage, }) => (super.noSuchMethod( - Invocation.method(#createScriptMessageHandler, [], { - #didReceiveScriptMessage: didReceiveScriptMessage, - }), - returnValue: _FakeWKScriptMessageHandler_5( - this, - Invocation.method(#createScriptMessageHandler, [], { - #didReceiveScriptMessage: didReceiveScriptMessage, - }), - ), - ) as _i2.WKScriptMessageHandler); + Invocation.method(#createScriptMessageHandler, [], { + #didReceiveScriptMessage: didReceiveScriptMessage, + }), + returnValue: _FakeWKScriptMessageHandler_5( + this, + Invocation.method(#createScriptMessageHandler, [], { + #didReceiveScriptMessage: didReceiveScriptMessage, + }), + ), + ) + as _i2.WKScriptMessageHandler); @override _i2.WKUIDelegate createUIDelgate({ @@ -1407,77 +1602,86 @@ class MockWebViewWidgetProxy extends _i1.Mock _i2.WKWebView, _i2.WKWebViewConfiguration, _i2.WKNavigationAction, - )? onCreateWebView, + )? + onCreateWebView, }) => (super.noSuchMethod( - Invocation.method(#createUIDelgate, [], { - #onCreateWebView: onCreateWebView, - }), - returnValue: _FakeWKUIDelegate_13( - this, - Invocation.method(#createUIDelgate, [], { - #onCreateWebView: onCreateWebView, - }), - ), - ) as _i2.WKUIDelegate); + Invocation.method(#createUIDelgate, [], { + #onCreateWebView: onCreateWebView, + }), + returnValue: _FakeWKUIDelegate_13( + this, + Invocation.method(#createUIDelgate, [], { + #onCreateWebView: onCreateWebView, + }), + ), + ) + as _i2.WKUIDelegate); @override _i2.WKNavigationDelegate createNavigationDelegate({ void Function(_i2.WKNavigationDelegate, _i2.WKWebView, String?)? - didFinishNavigation, + didFinishNavigation, void Function(_i2.WKNavigationDelegate, _i2.WKWebView, String?)? - didStartProvisionalNavigation, + didStartProvisionalNavigation, required _i4.Future<_i2.NavigationActionPolicy> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.WKNavigationAction, - )? decidePolicyForNavigationAction, + )? + decidePolicyForNavigationAction, void Function(_i2.WKNavigationDelegate, _i2.WKWebView, _i2.NSError)? - didFailNavigation, + didFailNavigation, void Function(_i2.WKNavigationDelegate, _i2.WKWebView, _i2.NSError)? - didFailProvisionalNavigation, + didFailProvisionalNavigation, void Function(_i2.WKNavigationDelegate, _i2.WKWebView)? - webViewWebContentProcessDidTerminate, + webViewWebContentProcessDidTerminate, required _i4.Future<_i2.NavigationResponsePolicy> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.WKNavigationResponse, - )? decidePolicyForNavigationResponse, + )? + decidePolicyForNavigationResponse, required _i4.Future> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.URLAuthenticationChallenge, - )? didReceiveAuthenticationChallenge, + )? + didReceiveAuthenticationChallenge, }) => (super.noSuchMethod( - Invocation.method(#createNavigationDelegate, [], { - #didFinishNavigation: didFinishNavigation, - #didStartProvisionalNavigation: didStartProvisionalNavigation, - #decidePolicyForNavigationAction: decidePolicyForNavigationAction, - #didFailNavigation: didFailNavigation, - #didFailProvisionalNavigation: didFailProvisionalNavigation, - #webViewWebContentProcessDidTerminate: - webViewWebContentProcessDidTerminate, - #decidePolicyForNavigationResponse: decidePolicyForNavigationResponse, - #didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, - }), - returnValue: _FakeWKNavigationDelegate_3( - this, - Invocation.method(#createNavigationDelegate, [], { - #didFinishNavigation: didFinishNavigation, - #didStartProvisionalNavigation: didStartProvisionalNavigation, - #decidePolicyForNavigationAction: decidePolicyForNavigationAction, - #didFailNavigation: didFailNavigation, - #didFailProvisionalNavigation: didFailProvisionalNavigation, - #webViewWebContentProcessDidTerminate: - webViewWebContentProcessDidTerminate, - #decidePolicyForNavigationResponse: - decidePolicyForNavigationResponse, - #didReceiveAuthenticationChallenge: - didReceiveAuthenticationChallenge, - }), - ), - ) as _i2.WKNavigationDelegate); + Invocation.method(#createNavigationDelegate, [], { + #didFinishNavigation: didFinishNavigation, + #didStartProvisionalNavigation: didStartProvisionalNavigation, + #decidePolicyForNavigationAction: decidePolicyForNavigationAction, + #didFailNavigation: didFailNavigation, + #didFailProvisionalNavigation: didFailProvisionalNavigation, + #webViewWebContentProcessDidTerminate: + webViewWebContentProcessDidTerminate, + #decidePolicyForNavigationResponse: + decidePolicyForNavigationResponse, + #didReceiveAuthenticationChallenge: + didReceiveAuthenticationChallenge, + }), + returnValue: _FakeWKNavigationDelegate_3( + this, + Invocation.method(#createNavigationDelegate, [], { + #didFinishNavigation: didFinishNavigation, + #didStartProvisionalNavigation: didStartProvisionalNavigation, + #decidePolicyForNavigationAction: + decidePolicyForNavigationAction, + #didFailNavigation: didFailNavigation, + #didFailProvisionalNavigation: didFailProvisionalNavigation, + #webViewWebContentProcessDidTerminate: + webViewWebContentProcessDidTerminate, + #decidePolicyForNavigationResponse: + decidePolicyForNavigationResponse, + #didReceiveAuthenticationChallenge: + didReceiveAuthenticationChallenge, + }), + ), + ) + as _i2.WKNavigationDelegate); } /// A class which mocks [WKWebpagePreferences]. @@ -1490,30 +1694,35 @@ class MockWKWebpagePreferences extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + 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); + 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_11( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebpagePreferences); + _i2.WKWebpagePreferences pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebpagePreferences_11( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebpagePreferences); @override _i4.Future addObserver( @@ -1522,16 +1731,18 @@ class MockWKWebpagePreferences extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) as _i4.Future); + 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); + 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 d7f7b5898799..fc649dd973de 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 @@ -3,8 +3,10 @@ // found in the LICENSE file. import 'dart:async'; +import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; @@ -16,7 +18,12 @@ import 'package:webview_flutter_wkwebview/webview_flutter_wkwebview.dart'; import 'webkit_navigation_delegate_test.mocks.dart'; -@GenerateMocks([URLAuthenticationChallenge, URLRequest, URL]) +@GenerateMocks([ + URLAuthenticationChallenge, + URLProtectionSpace, + URLRequest, + URL, +]) void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -593,6 +600,143 @@ void main() { expect(callbackHost, expectedHost); expect(callbackRealm, expectedRealm); }); + + test('setOnSSlAuthError', () async { + const String exceptionCode = 'code'; + const String exceptionMessage = 'message'; + final Uint8List copiedExceptions = Uint8List(0); + final SecCertificate leafCertificate = SecCertificate.pigeon_detached( + pigeon_instanceManager: TestInstanceManager(), + ); + final Uint8List certificateData = Uint8List(0); + + final WebKitNavigationDelegate iosNavigationDelegate = + WebKitNavigationDelegate( + WebKitNavigationDelegateCreationParams( + webKitProxy: WebKitProxy( + newWKNavigationDelegate: CapturingNavigationDelegate.new, + evaluateWithErrorSecTrust: (_) async { + throw PlatformException( + code: exceptionCode, + message: exceptionMessage, + ); + }, + copyExceptionsSecTrust: (_) async => copiedExceptions, + setExceptionsSecTrust: expectAsync2( + (_, Uint8List? exceptions) async { + expect(exceptions, copiedExceptions); + return true; + }, + ), + getTrustResultSecTrust: (_) async { + return GetTrustResultResponse.pigeon_detached( + result: DartSecTrustResultType.recoverableTrustFailure, + resultCode: 0, + pigeon_instanceManager: TestInstanceManager(), + ); + }, + copyCertificateChainSecTrust: (_) async { + return [leafCertificate]; + }, + copyDataSecCertificate: (_) async => certificateData, + ), + ), + ); + + Completer errorCompleter = + Completer(); + await iosNavigationDelegate.setOnSSlAuthError( + (PlatformSslAuthError error) { + errorCompleter.complete(error); + }, + ); + + const int port = 65; + const String host = 'host'; + + final MockURLAuthenticationChallenge mockChallenge = + MockURLAuthenticationChallenge(); + final SecTrust testTrust = SecTrust.pigeon_detached( + pigeon_instanceManager: TestInstanceManager(), + ); + when(mockChallenge.getProtectionSpace()).thenAnswer( + (_) async { + final MockURLProtectionSpace mockProtectionSpace = + MockURLProtectionSpace(); + when(mockProtectionSpace.port).thenReturn(port); + when(mockProtectionSpace.host).thenReturn(host); + when(mockProtectionSpace.authenticationMethod).thenReturn( + NSUrlAuthenticationMethod.serverTrust, + ); + when(mockProtectionSpace.getServerTrust()).thenAnswer( + (_) async => testTrust, + ); + return mockProtectionSpace; + }, + ); + + final WKNavigationDelegate testDelegate = + WKNavigationDelegate.pigeon_detached( + pigeon_instanceManager: TestInstanceManager(), + decidePolicyForNavigationAction: (_, __, ___) async { + return NavigationActionPolicy.cancel; + }, + decidePolicyForNavigationResponse: (_, __, ___) async { + return NavigationResponsePolicy.cancel; + }, + didReceiveAuthenticationChallenge: (_, __, ___) async { + return [ + UrlSessionAuthChallengeDisposition.performDefaultHandling, + null, + ]; + }, + ); + final WKWebView testWebView = WKWebView.pigeon_detached( + pigeon_instanceManager: TestInstanceManager(), + ); + + Future> authReplyFuture = CapturingNavigationDelegate + .lastCreatedDelegate + .didReceiveAuthenticationChallenge( + testDelegate, + testWebView, + mockChallenge, + ); + + WebKitSslAuthError error = + await errorCompleter.future as WebKitSslAuthError; + expect(error.certificate?.data, certificateData); + expect(error.description, '$exceptionCode: $exceptionMessage'); + expect(error.host, host); + expect(error.port, port); + + // Test proceed. + await error.proceed(); + + List authReply = await authReplyFuture; + expect(authReply, [ + UrlSessionAuthChallengeDisposition.useCredential, + {'serverTrust': testTrust}, + ]); + + // Test cancel. + errorCompleter = Completer(); + authReplyFuture = CapturingNavigationDelegate.lastCreatedDelegate + .didReceiveAuthenticationChallenge( + testDelegate, + testWebView, + mockChallenge, + ); + + error = await errorCompleter.future as WebKitSslAuthError; + await error.cancel(); + + authReply = await authReplyFuture; + expect(authReply, [ + UrlSessionAuthChallengeDisposition.cancelAuthenticationChallenge, + null, + ]); + }); }); } 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 503c38a6dc5d..36a866a10ab1 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 @@ -4,10 +4,10 @@ // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; -import 'dart:typed_data' as _i4; +import 'dart:typed_data' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i5; +import 'package:mockito/src/dummies.dart' as _i4; import 'package:webview_flutter_wkwebview/src/common/web_kit.g.dart' as _i2; // ignore_for_file: type=lint @@ -27,29 +27,29 @@ 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); + : super(parent, parentInvocation); } class _FakeURLProtectionSpace_1 extends _i1.SmartFake implements _i2.URLProtectionSpace { _FakeURLProtectionSpace_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURLAuthenticationChallenge_2 extends _i1.SmartFake implements _i2.URLAuthenticationChallenge { _FakeURLAuthenticationChallenge_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURLRequest_3 extends _i1.SmartFake implements _i2.URLRequest { _FakeURLRequest_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURL_4 extends _i1.SmartFake implements _i2.URL { _FakeURL_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [URLAuthenticationChallenge]. @@ -62,34 +62,39 @@ class MockURLAuthenticationChallenge extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override _i3.Future<_i2.URLProtectionSpace> getProtectionSpace() => (super.noSuchMethod( - Invocation.method(#getProtectionSpace, []), - returnValue: _i3.Future<_i2.URLProtectionSpace>.value( - _FakeURLProtectionSpace_1( - this, Invocation.method(#getProtectionSpace, []), - ), - ), - ) as _i3.Future<_i2.URLProtectionSpace>); + 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, []), - returnValue: _FakeURLAuthenticationChallenge_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.URLAuthenticationChallenge); + _i2.URLAuthenticationChallenge pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLAuthenticationChallenge_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.URLAuthenticationChallenge); @override _i3.Future addObserver( @@ -98,18 +103,94 @@ class MockURLAuthenticationChallenge extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); +} + +/// A class which mocks [URLProtectionSpace]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockURLProtectionSpace extends _i1.Mock + implements _i2.URLProtectionSpace { + MockURLProtectionSpace() { + _i1.throwOnMissingStub(this); + } + + @override + String get host => + (super.noSuchMethod( + Invocation.getter(#host), + returnValue: _i4.dummyValue(this, Invocation.getter(#host)), + ) + as String); + + @override + int get port => + (super.noSuchMethod(Invocation.getter(#port), returnValue: 0) as int); + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); + + @override + _i3.Future<_i2.SecTrust?> getServerTrust() => + (super.noSuchMethod( + Invocation.method(#getServerTrust, []), + returnValue: _i3.Future<_i2.SecTrust?>.value(), + ) + as _i3.Future<_i2.SecTrust?>); + + @override + _i2.URLProtectionSpace pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLProtectionSpace_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.URLProtectionSpace); + + @override + _i3.Future addObserver( + _i2.NSObject? observer, + String? keyPath, + List<_i2.KeyValueObservingOptions>? options, + ) => + (super.noSuchMethod( + 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 [URLRequest]. @@ -121,69 +202,85 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i3.Future getUrl() => (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i3.Future.value(), - ) as _i3.Future); + _i3.Future getUrl() => + (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future setHttpMethod(String? method) => (super.noSuchMethod( - Invocation.method(#setHttpMethod, [method]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setHttpMethod(String? method) => + (super.noSuchMethod( + Invocation.method(#setHttpMethod, [method]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future getHttpMethod() => (super.noSuchMethod( - Invocation.method(#getHttpMethod, []), - returnValue: _i3.Future.value(), - ) as _i3.Future); + _i3.Future getHttpMethod() => + (super.noSuchMethod( + Invocation.method(#getHttpMethod, []), + returnValue: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future setHttpBody(_i4.Uint8List? body) => (super.noSuchMethod( - Invocation.method(#setHttpBody, [body]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setHttpBody(_i5.Uint8List? body) => + (super.noSuchMethod( + 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, []), - returnValue: _i3.Future<_i4.Uint8List?>.value(), - ) as _i3.Future<_i4.Uint8List?>); + _i3.Future<_i5.Uint8List?> getHttpBody() => + (super.noSuchMethod( + Invocation.method(#getHttpBody, []), + returnValue: _i3.Future<_i5.Uint8List?>.value(), + ) + as _i3.Future<_i5.Uint8List?>); @override _i3.Future setAllHttpHeaderFields(Map? fields) => (super.noSuchMethod( - Invocation.method(#setAllHttpHeaderFields, [fields]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setAllHttpHeaderFields, [fields]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method(#getAllHttpHeaderFields, []), - returnValue: _i3.Future?>.value(), - ) as _i3.Future?>); + Invocation.method(#getAllHttpHeaderFields, []), + returnValue: _i3.Future?>.value(), + ) + as _i3.Future?>); @override - _i2.URLRequest pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeURLRequest_3( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.URLRequest); + _i2.URLRequest pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLRequest_3( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.URLRequest); @override _i3.Future addObserver( @@ -192,18 +289,20 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [URL]. @@ -215,30 +314,36 @@ class MockURL extends _i1.Mock implements _i2.URL { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i3.Future getAbsoluteString() => (super.noSuchMethod( - Invocation.method(#getAbsoluteString, []), - returnValue: _i3.Future.value( - _i5.dummyValue( - this, + _i3.Future getAbsoluteString() => + (super.noSuchMethod( Invocation.method(#getAbsoluteString, []), - ), - ), - ) as _i3.Future); + returnValue: _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_4(this, Invocation.method(#pigeon_copy, [])), - ) as _i2.URL); + _i2.URL pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURL_4(this, Invocation.method(#pigeon_copy, [])), + ) + as _i2.URL); @override _i3.Future addObserver( @@ -247,16 +352,18 @@ class MockURL extends _i1.Mock implements _i2.URL { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + 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.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart index 3bbeec9f6c3a..a32e07bfdf22 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 @@ -27,85 +27,85 @@ 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); + : super(parent, parentInvocation); } class _FakeUIScrollView_1 extends _i1.SmartFake implements _i2.UIScrollView { _FakeUIScrollView_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeUIScrollViewDelegate_2 extends _i1.SmartFake implements _i2.UIScrollViewDelegate { _FakeUIScrollViewDelegate_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURL_3 extends _i1.SmartFake implements _i2.URL { _FakeURL_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURLRequest_4 extends _i1.SmartFake implements _i2.URLRequest { _FakeURLRequest_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKPreferences_5 extends _i1.SmartFake implements _i2.WKPreferences { _FakeWKPreferences_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKScriptMessageHandler_6 extends _i1.SmartFake implements _i2.WKScriptMessageHandler { _FakeWKScriptMessageHandler_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUserContentController_7 extends _i1.SmartFake implements _i2.WKUserContentController { _FakeWKUserContentController_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUserScript_8 extends _i1.SmartFake implements _i2.WKUserScript { _FakeWKUserScript_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebView_9 extends _i1.SmartFake implements _i2.WKWebView { _FakeWKWebView_9(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_10 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_10(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebpagePreferences_11 extends _i1.SmartFake implements _i2.WKWebpagePreferences { _FakeWKWebpagePreferences_11(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebViewConfiguration_12 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { _FakeWKWebViewConfiguration_12(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeUIViewWKWebView_13 extends _i1.SmartFake implements _i2.UIViewWKWebView { _FakeUIViewWKWebView_13(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKHTTPCookieStore_14 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { _FakeWKHTTPCookieStore_14(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [UIScrollView]. @@ -113,112 +113,135 @@ class _FakeWKHTTPCookieStore_14 extends _i1.SmartFake /// See the documentation for Mockito's code generation for more information. class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @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> getContentOffset() => (super.noSuchMethod( - Invocation.method(#getContentOffset, []), - returnValue: _i3.Future>.value([]), - returnValueForMissingStub: _i3.Future>.value( - [], - ), - ) as _i3.Future>); + _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> getContentOffset() => + (super.noSuchMethod( + Invocation.method(#getContentOffset, []), + returnValue: _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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _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) => (super.noSuchMethod( - Invocation.method(#setContentOffset, [x, y]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setContentOffset, [x, y]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future setDelegate(_i2.UIScrollViewDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setDelegate, [delegate]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + _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); + _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); + _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); + _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); + 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, []), - returnValue: _FakeUIScrollView_1( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeUIScrollView_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.UIScrollView); - - @override - _i3.Future setBackgroundColor(int? value) => (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [value]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i2.UIScrollView pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollView_1( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeUIScrollView_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.UIScrollView); + + @override + _i3.Future setBackgroundColor(int? value) => + (super.noSuchMethod( + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setOpaque(bool? opaque) => + (super.noSuchMethod( + Invocation.method(#setOpaque, [opaque]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future addObserver( @@ -227,18 +250,20 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [UIScrollViewDelegate]. @@ -247,30 +272,34 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { class MockUIScrollViewDelegate extends _i1.Mock implements _i2.UIScrollViewDelegate { @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 - _i2.UIScrollViewDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeUIScrollViewDelegate_2( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeUIScrollViewDelegate_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.UIScrollViewDelegate); + _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 + _i2.UIScrollViewDelegate pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollViewDelegate_2( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeUIScrollViewDelegate_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.UIScrollViewDelegate); @override _i3.Future addObserver( @@ -279,18 +308,20 @@ class MockUIScrollViewDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [URL]. @@ -298,44 +329,50 @@ class MockUIScrollViewDelegate extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockURL extends _i1.Mock implements _i2.URL { @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 getAbsoluteString() => (super.noSuchMethod( - Invocation.method(#getAbsoluteString, []), - returnValue: _i3.Future.value( - _i4.dummyValue( - this, - Invocation.method(#getAbsoluteString, []), - ), - ), - returnValueForMissingStub: _i3.Future.value( - _i4.dummyValue( - this, + _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 getAbsoluteString() => + (super.noSuchMethod( 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, [])), - returnValueForMissingStub: _FakeURL_3( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.URL); + returnValue: _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, [])), + returnValueForMissingStub: _FakeURL_3( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.URL); @override _i3.Future addObserver( @@ -344,18 +381,20 @@ class MockURL extends _i1.Mock implements _i2.URL { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [URLRequest]. @@ -363,81 +402,97 @@ class MockURL extends _i1.Mock implements _i2.URL { /// See the documentation for Mockito's code generation for more information. class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @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 getUrl() => (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _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 getUrl() => + (super.noSuchMethod( + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setHttpMethod(String? method) => + (super.noSuchMethod( + Invocation.method(#setHttpMethod, [method]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future getHttpMethod() => (super.noSuchMethod( - Invocation.method(#getHttpMethod, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future getHttpMethod() => + (super.noSuchMethod( + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setHttpBody(_i5.Uint8List? body) => + (super.noSuchMethod( + 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, []), - returnValue: _i3.Future<_i5.Uint8List?>.value(), - returnValueForMissingStub: _i3.Future<_i5.Uint8List?>.value(), - ) as _i3.Future<_i5.Uint8List?>); + _i3.Future<_i5.Uint8List?> getHttpBody() => + (super.noSuchMethod( + Invocation.method(#getHttpBody, []), + returnValue: _i3.Future<_i5.Uint8List?>.value(), + returnValueForMissingStub: _i3.Future<_i5.Uint8List?>.value(), + ) + as _i3.Future<_i5.Uint8List?>); @override _i3.Future setAllHttpHeaderFields(Map? fields) => (super.noSuchMethod( - Invocation.method(#setAllHttpHeaderFields, [fields]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setAllHttpHeaderFields, [fields]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method(#getAllHttpHeaderFields, []), - returnValue: _i3.Future?>.value(), - returnValueForMissingStub: _i3.Future?>.value(), - ) as _i3.Future?>); + 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, []), - returnValue: _FakeURLRequest_4( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeURLRequest_4( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.URLRequest); + _i2.URLRequest pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLRequest_4( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeURLRequest_4( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.URLRequest); @override _i3.Future addObserver( @@ -446,18 +501,20 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKPreferences]. @@ -465,37 +522,43 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { /// See the documentation for Mockito's code generation for more information. class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { @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 setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod( - 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, []), - returnValue: _FakeWKPreferences_5( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKPreferences_5( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKPreferences); + _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 setJavaScriptEnabled(bool? enabled) => + (super.noSuchMethod( + 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, []), + returnValue: _FakeWKPreferences_5( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKPreferences_5( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKPreferences); @override _i3.Future addObserver( @@ -504,18 +567,20 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKScriptMessageHandler]. @@ -528,49 +593,58 @@ class MockWKScriptMessageHandler extends _i1.Mock _i2.WKScriptMessageHandler, _i2.WKUserContentController, _i2.WKScriptMessage, - ) get didReceiveScriptMessage => (super.noSuchMethod( - Invocation.getter(#didReceiveScriptMessage), - returnValue: ( - _i2.WKScriptMessageHandler pigeon_instance, - _i2.WKUserContentController controller, - _i2.WKScriptMessage message, - ) {}, - returnValueForMissingStub: ( - _i2.WKScriptMessageHandler pigeon_instance, - _i2.WKUserContentController controller, - _i2.WKScriptMessage message, - ) {}, - ) as void Function( - _i2.WKScriptMessageHandler, - _i2.WKUserContentController, - _i2.WKScriptMessage, - )); - - @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 - _i2.WKScriptMessageHandler pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKScriptMessageHandler_6( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKScriptMessageHandler_6( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKScriptMessageHandler); + ) + get didReceiveScriptMessage => + (super.noSuchMethod( + Invocation.getter(#didReceiveScriptMessage), + returnValue: + ( + _i2.WKScriptMessageHandler pigeon_instance, + _i2.WKUserContentController controller, + _i2.WKScriptMessage message, + ) {}, + returnValueForMissingStub: + ( + _i2.WKScriptMessageHandler pigeon_instance, + _i2.WKUserContentController controller, + _i2.WKScriptMessage message, + ) {}, + ) + as void Function( + _i2.WKScriptMessageHandler, + _i2.WKUserContentController, + _i2.WKScriptMessage, + )); + + @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 + _i2.WKScriptMessageHandler pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKScriptMessageHandler_6( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKScriptMessageHandler_6( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKScriptMessageHandler); @override _i3.Future addObserver( @@ -579,18 +653,20 @@ class MockWKScriptMessageHandler extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKUserContentController]. @@ -599,17 +675,19 @@ class MockWKScriptMessageHandler extends _i1.Mock class MockWKUserContentController extends _i1.Mock implements _i2.WKUserContentController { @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); + _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 addScriptMessageHandler( @@ -617,53 +695,62 @@ class MockWKUserContentController extends _i1.Mock String? name, ) => (super.noSuchMethod( - Invocation.method(#addScriptMessageHandler, [handler, name]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#addScriptMessageHandler, [handler, name]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( - Invocation.method(#removeScriptMessageHandler, [name]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#removeScriptMessageHandler, [name]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( - Invocation.method(#removeAllScriptMessageHandlers, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future removeAllScriptMessageHandlers() => + (super.noSuchMethod( + Invocation.method(#removeAllScriptMessageHandlers, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future addUserScript(_i2.WKUserScript? userScript) => (super.noSuchMethod( - Invocation.method(#addUserScript, [userScript]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#addUserScript, [userScript]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future removeAllUserScripts() => (super.noSuchMethod( - Invocation.method(#removeAllUserScripts, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future removeAllUserScripts() => + (super.noSuchMethod( + 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, []), - returnValue: _FakeWKUserContentController_7( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKUserContentController_7( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKUserContentController); + _i2.WKUserContentController pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUserContentController_7( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKUserContentController_7( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKUserContentController); @override _i3.Future addObserver( @@ -672,18 +759,20 @@ class MockWKUserContentController extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKUserScript]. @@ -691,57 +780,68 @@ class MockWKUserContentController extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockWKUserScript extends _i1.Mock implements _i2.WKUserScript { @override - String get source => (super.noSuchMethod( - Invocation.getter(#source), - returnValue: _i4.dummyValue( - this, - Invocation.getter(#source), - ), - returnValueForMissingStub: _i4.dummyValue( - this, - Invocation.getter(#source), - ), - ) as String); - - @override - _i2.UserScriptInjectionTime get injectionTime => (super.noSuchMethod( - Invocation.getter(#injectionTime), - returnValue: _i2.UserScriptInjectionTime.atDocumentStart, - returnValueForMissingStub: _i2.UserScriptInjectionTime.atDocumentStart, - ) as _i2.UserScriptInjectionTime); - - @override - bool get isForMainFrameOnly => (super.noSuchMethod( - Invocation.getter(#isForMainFrameOnly), - returnValue: false, - returnValueForMissingStub: false, - ) as bool); - - @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 - _i2.WKUserScript pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKUserScript_8( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKUserScript_8( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKUserScript); + String get source => + (super.noSuchMethod( + Invocation.getter(#source), + returnValue: _i4.dummyValue( + this, + Invocation.getter(#source), + ), + returnValueForMissingStub: _i4.dummyValue( + this, + Invocation.getter(#source), + ), + ) + as String); + + @override + _i2.UserScriptInjectionTime get injectionTime => + (super.noSuchMethod( + Invocation.getter(#injectionTime), + returnValue: _i2.UserScriptInjectionTime.atDocumentStart, + returnValueForMissingStub: + _i2.UserScriptInjectionTime.atDocumentStart, + ) + as _i2.UserScriptInjectionTime); + + @override + bool get isForMainFrameOnly => + (super.noSuchMethod( + Invocation.getter(#isForMainFrameOnly), + returnValue: false, + returnValueForMissingStub: false, + ) + as bool); + + @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 + _i2.WKUserScript pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUserScript_8( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKUserScript_8( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKUserScript); @override _i3.Future addObserver( @@ -750,18 +850,20 @@ class MockWKUserScript extends _i1.Mock implements _i2.WKUserScript { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKWebView]. @@ -769,30 +871,34 @@ class MockWKUserScript extends _i1.Mock implements _i2.WKUserScript { /// See the documentation for Mockito's code generation for more information. class MockWKWebView extends _i1.Mock implements _i2.WKWebView { @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 - _i2.WKWebView pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebView_9( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKWebView_9( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebView); + _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 + _i2.WKWebView pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebView_9( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKWebView_9( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebView); @override _i3.Future addObserver( @@ -801,18 +907,20 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKWebViewConfiguration]. @@ -821,156 +929,172 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { class MockWKWebViewConfiguration extends _i1.Mock implements _i2.WKWebViewConfiguration { @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); + _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 setUserContentController( _i2.WKUserContentController? controller, ) => (super.noSuchMethod( - Invocation.method(#setUserContentController, [controller]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setUserContentController, [controller]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( - Invocation.method(#getUserContentController, []), - returnValue: _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_7( - this, - Invocation.method(#getUserContentController, []), - ), - ), - returnValueForMissingStub: - _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_7( - this, Invocation.method(#getUserContentController, []), - ), - ), - ) as _i3.Future<_i2.WKUserContentController>); + returnValue: _i3.Future<_i2.WKUserContentController>.value( + _FakeWKUserContentController_7( + this, + Invocation.method(#getUserContentController, []), + ), + ), + returnValueForMissingStub: + _i3.Future<_i2.WKUserContentController>.value( + _FakeWKUserContentController_7( + this, + Invocation.method(#getUserContentController, []), + ), + ), + ) + as _i3.Future<_i2.WKUserContentController>); @override _i3.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method(#setWebsiteDataStore, [dataStore]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setWebsiteDataStore, [dataStore]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( - 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, []), - ), - ), - ) as _i3.Future<_i2.WKWebsiteDataStore>); + returnValue: _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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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, []), - ), - ), - returnValueForMissingStub: _i3.Future<_i2.WKPreferences>.value( - _FakeWKPreferences_5( - this, + _i3.Future<_i2.WKPreferences> getPreferences() => + (super.noSuchMethod( Invocation.method(#getPreferences, []), - ), - ), - ) as _i3.Future<_i2.WKPreferences>); + returnValue: _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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future setMediaTypesRequiringUserActionForPlayback( _i2.AudiovisualMediaType? type, ) => (super.noSuchMethod( - Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ - type, - ]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( - Invocation.method(#getDefaultWebpagePreferences, []), - returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, Invocation.method(#getDefaultWebpagePreferences, []), - ), - ), - returnValueForMissingStub: _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, - Invocation.method(#getDefaultWebpagePreferences, []), - ), - ), - ) 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, []), - ), - ) as _i2.WKWebViewConfiguration); + returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_11( + this, + Invocation.method(#getDefaultWebpagePreferences, []), + ), + ), + returnValueForMissingStub: + _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_11( + this, + Invocation.method(#getDefaultWebpagePreferences, []), + ), + ), + ) + 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, []), + ), + ) + as _i2.WKWebViewConfiguration); @override _i3.Future addObserver( @@ -979,18 +1103,20 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKWebpagePreferences]. @@ -999,38 +1125,43 @@ class MockWKWebViewConfiguration extends _i1.Mock 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); + _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); + Invocation.method(#setAllowsContentJavaScript, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _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); + _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( @@ -1039,18 +1170,20 @@ class MockWKWebpagePreferences extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [UIViewWKWebView]. @@ -1058,242 +1191,292 @@ class MockWKWebpagePreferences extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override - _i2.WKWebViewConfiguration get configuration => (super.noSuchMethod( - Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_12( - this, - Invocation.getter(#configuration), - ), - returnValueForMissingStub: _FakeWKWebViewConfiguration_12( - this, - Invocation.getter(#configuration), - ), - ) as _i2.WKWebViewConfiguration); - - @override - _i2.UIScrollView get scrollView => (super.noSuchMethod( - Invocation.getter(#scrollView), - returnValue: _FakeUIScrollView_1( - this, - Invocation.getter(#scrollView), - ), - returnValueForMissingStub: _FakeUIScrollView_1( - this, - Invocation.getter(#scrollView), - ), - ) as _i2.UIScrollView); - - @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 - _i2.WKWebViewConfiguration pigeonVar_configuration() => (super.noSuchMethod( - Invocation.method(#pigeonVar_configuration, []), - returnValue: _FakeWKWebViewConfiguration_12( - this, - Invocation.method(#pigeonVar_configuration, []), - ), - returnValueForMissingStub: _FakeWKWebViewConfiguration_12( - this, - Invocation.method(#pigeonVar_configuration, []), - ), - ) as _i2.WKWebViewConfiguration); - - @override - _i2.UIScrollView pigeonVar_scrollView() => (super.noSuchMethod( - Invocation.method(#pigeonVar_scrollView, []), - returnValue: _FakeUIScrollView_1( - this, - Invocation.method(#pigeonVar_scrollView, []), - ), - returnValueForMissingStub: _FakeUIScrollView_1( - this, - Invocation.method(#pigeonVar_scrollView, []), - ), - ) as _i2.UIScrollView); + _i2.WKWebViewConfiguration get configuration => + (super.noSuchMethod( + Invocation.getter(#configuration), + returnValue: _FakeWKWebViewConfiguration_12( + this, + Invocation.getter(#configuration), + ), + returnValueForMissingStub: _FakeWKWebViewConfiguration_12( + this, + Invocation.getter(#configuration), + ), + ) + as _i2.WKWebViewConfiguration); + + @override + _i2.UIScrollView get scrollView => + (super.noSuchMethod( + Invocation.getter(#scrollView), + returnValue: _FakeUIScrollView_1( + this, + Invocation.getter(#scrollView), + ), + returnValueForMissingStub: _FakeUIScrollView_1( + this, + Invocation.getter(#scrollView), + ), + ) + as _i2.UIScrollView); + + @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 + _i2.WKWebViewConfiguration pigeonVar_configuration() => + (super.noSuchMethod( + Invocation.method(#pigeonVar_configuration, []), + returnValue: _FakeWKWebViewConfiguration_12( + this, + Invocation.method(#pigeonVar_configuration, []), + ), + returnValueForMissingStub: _FakeWKWebViewConfiguration_12( + this, + Invocation.method(#pigeonVar_configuration, []), + ), + ) + as _i2.WKWebViewConfiguration); + + @override + _i2.UIScrollView pigeonVar_scrollView() => + (super.noSuchMethod( + Invocation.method(#pigeonVar_scrollView, []), + returnValue: _FakeUIScrollView_1( + this, + Invocation.method(#pigeonVar_scrollView, []), + ), + returnValueForMissingStub: _FakeUIScrollView_1( + this, + Invocation.method(#pigeonVar_scrollView, []), + ), + ) + as _i2.UIScrollView); @override _i3.Future setUIDelegate(_i2.WKUIDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setUIDelegate, [delegate]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setUIDelegate, [delegate]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future setNavigationDelegate(_i2.WKNavigationDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setNavigationDelegate, [delegate]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setNavigationDelegate, [delegate]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future getUrl() => (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future getUrl() => + (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future getEstimatedProgress() => (super.noSuchMethod( - Invocation.method(#getEstimatedProgress, []), - returnValue: _i3.Future.value(0.0), - returnValueForMissingStub: _i3.Future.value(0.0), - ) as _i3.Future); + _i3.Future getEstimatedProgress() => + (super.noSuchMethod( + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future load(_i2.URLRequest? request) => + (super.noSuchMethod( + Invocation.method(#load, [request]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future loadHtmlString(String? string, String? baseUrl) => (super.noSuchMethod( - Invocation.method(#loadHtmlString, [string, baseUrl]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#loadHtmlString, [string, baseUrl]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future loadFileUrl(String? url, String? readAccessUrl) => (super.noSuchMethod( - Invocation.method(#loadFileUrl, [url, readAccessUrl]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future loadFlutterAsset(String? key) => + (super.noSuchMethod( + Invocation.method(#loadFlutterAsset, [key]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future canGoBack() => (super.noSuchMethod( - Invocation.method(#canGoBack, []), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) as _i3.Future); + _i3.Future canGoBack() => + (super.noSuchMethod( + 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, []), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) as _i3.Future); + _i3.Future canGoForward() => + (super.noSuchMethod( + 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, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future goBack() => + (super.noSuchMethod( + Invocation.method(#goBack, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future goForward() => (super.noSuchMethod( - Invocation.method(#goForward, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future goForward() => + (super.noSuchMethod( + Invocation.method(#goForward, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future reload() => (super.noSuchMethod( - Invocation.method(#reload, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future reload() => + (super.noSuchMethod( + Invocation.method(#reload, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future getTitle() => (super.noSuchMethod( - Invocation.method(#getTitle, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future getTitle() => + (super.noSuchMethod( + Invocation.method(#getTitle, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsBackForwardNavigationGestures, [allow]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setCustomUserAgent(String? userAgent) => + (super.noSuchMethod( + Invocation.method(#setCustomUserAgent, [userAgent]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( - Invocation.method(#evaluateJavaScript, [javaScriptString]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - - @override - _i3.Future getCustomUserAgent() => (super.noSuchMethod( - Invocation.method(#getCustomUserAgent, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setInspectable(bool? inspectable) => + (super.noSuchMethod( + Invocation.method(#setInspectable, [inspectable]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future setAllowsLinkPreview(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsLinkPreview, [allow]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future getCustomUserAgent() => + (super.noSuchMethod( + 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_13( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeUIViewWKWebView_13( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.UIViewWKWebView); + _i3.Future setAllowsLinkPreview(bool? allow) => + (super.noSuchMethod( + Invocation.method(#setAllowsLinkPreview, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override - _i3.Future setBackgroundColor(int? value) => (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [value]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i2.UIViewWKWebView pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIViewWKWebView_13( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeUIViewWKWebView_13( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.UIViewWKWebView); + + @override + _i3.Future setBackgroundColor(int? value) => + (super.noSuchMethod( + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setOpaque(bool? opaque) => + (super.noSuchMethod( + Invocation.method(#setOpaque, [opaque]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future addObserver( @@ -1302,18 +1485,20 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKWebsiteDataStore]. @@ -1322,43 +1507,49 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { class MockWKWebsiteDataStore extends _i1.Mock implements _i2.WKWebsiteDataStore { @override - _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( - Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_14( - this, - Invocation.getter(#httpCookieStore), - ), - returnValueForMissingStub: _FakeWKHTTPCookieStore_14( - this, - Invocation.getter(#httpCookieStore), - ), - ) as _i2.WKHTTPCookieStore); - - @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 - _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_14( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - returnValueForMissingStub: _FakeWKHTTPCookieStore_14( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore get httpCookieStore => + (super.noSuchMethod( + Invocation.getter(#httpCookieStore), + returnValue: _FakeWKHTTPCookieStore_14( + this, + Invocation.getter(#httpCookieStore), + ), + returnValueForMissingStub: _FakeWKHTTPCookieStore_14( + this, + Invocation.getter(#httpCookieStore), + ), + ) + as _i2.WKHTTPCookieStore); + + @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 + _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => + (super.noSuchMethod( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_14( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + returnValueForMissingStub: _FakeWKHTTPCookieStore_14( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + ) + as _i2.WKHTTPCookieStore); @override _i3.Future removeDataOfTypes( @@ -1366,26 +1557,29 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method(#removeDataOfTypes, [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ]), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) as _i3.Future); + 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, []), - returnValue: _FakeWKWebsiteDataStore_10( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKWebsiteDataStore_10( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebsiteDataStore); + _i2.WKWebsiteDataStore pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebsiteDataStore); @override _i3.Future addObserver( @@ -1394,16 +1588,18 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + 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 d494fbba2091..ce8c5682afca 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 @@ -25,19 +25,19 @@ 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); + : super(parent, parentInvocation); } class _FakePigeonInstanceManager_1 extends _i1.SmartFake implements _i2.PigeonInstanceManager { _FakePigeonInstanceManager_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_2 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [WKWebsiteDataStore]. @@ -50,31 +50,37 @@ class MockWKWebsiteDataStore extends _i1.Mock } @override - _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( - Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_0( - this, - Invocation.getter(#httpCookieStore), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore get httpCookieStore => + (super.noSuchMethod( + Invocation.getter(#httpCookieStore), + returnValue: _FakeWKHTTPCookieStore_0( + this, + Invocation.getter(#httpCookieStore), + ), + ) + as _i2.WKHTTPCookieStore); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_1( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_1( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_0( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => + (super.noSuchMethod( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_0( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + ) + as _i2.WKHTTPCookieStore); @override _i3.Future removeDataOfTypes( @@ -82,21 +88,24 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method(#removeDataOfTypes, [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ]), - returnValue: _i3.Future.value(false), - ) as _i3.Future); + Invocation.method(#removeDataOfTypes, [ + dataTypes, + modificationTimeInSecondsSinceEpoch, + ]), + returnValue: _i3.Future.value(false), + ) + as _i3.Future); @override - _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebsiteDataStore_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebsiteDataStore); + _i2.WKWebsiteDataStore pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebsiteDataStore); @override _i3.Future addObserver( @@ -105,18 +114,20 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKHTTPCookieStore]. @@ -128,29 +139,35 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_1( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_1( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i3.Future setCookie(_i2.HTTPCookie? cookie) => (super.noSuchMethod( - Invocation.method(#setCookie, [cookie]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + _i3.Future setCookie(_i2.HTTPCookie? cookie) => + (super.noSuchMethod( + 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, []), - returnValue: _FakeWKHTTPCookieStore_0( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKHTTPCookieStore_0( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKHTTPCookieStore); @override _i3.Future addObserver( @@ -159,16 +176,18 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + 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 ce4ab60e4a0e..2e977a8f1a85 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 @@ -25,47 +25,47 @@ 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); + : super(parent, parentInvocation); } class _FakeWKUIDelegate_1 extends _i1.SmartFake implements _i2.WKUIDelegate { _FakeWKUIDelegate_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUserContentController_2 extends _i1.SmartFake implements _i2.WKUserContentController { _FakeWKUserContentController_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_3 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKPreferences_4 extends _i1.SmartFake implements _i2.WKPreferences { _FakeWKPreferences_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebpagePreferences_5 extends _i1.SmartFake implements _i2.WKWebpagePreferences { _FakeWKWebpagePreferences_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebViewConfiguration_6 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { _FakeWKWebViewConfiguration_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeUIScrollViewDelegate_7 extends _i1.SmartFake implements _i2.UIScrollViewDelegate { _FakeUIScrollViewDelegate_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [WKUIDelegate]. @@ -83,25 +83,28 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { _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, - )); + ) + 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( @@ -109,39 +112,46 @@ class MockWKUIDelegate extends _i1.Mock implements _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, - )); + ) + 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), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i2.WKUIDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKUIDelegate_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKUIDelegate); + _i2.WKUIDelegate pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUIDelegate_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKUIDelegate); @override _i3.Future addObserver( @@ -150,18 +160,20 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [WKWebViewConfiguration]. @@ -174,123 +186,138 @@ class MockWKWebViewConfiguration extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override _i3.Future setUserContentController( _i2.WKUserContentController? controller, ) => (super.noSuchMethod( - Invocation.method(#setUserContentController, [controller]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setUserContentController, [controller]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( - Invocation.method(#getUserContentController, []), - returnValue: _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_2( - this, Invocation.method(#getUserContentController, []), - ), - ), - ) as _i3.Future<_i2.WKUserContentController>); + returnValue: _i3.Future<_i2.WKUserContentController>.value( + _FakeWKUserContentController_2( + this, + Invocation.method(#getUserContentController, []), + ), + ), + ) + as _i3.Future<_i2.WKUserContentController>); @override _i3.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method(#setWebsiteDataStore, [dataStore]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setWebsiteDataStore, [dataStore]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( - Invocation.method(#getWebsiteDataStore, []), - returnValue: _i3.Future<_i2.WKWebsiteDataStore>.value( - _FakeWKWebsiteDataStore_3( - this, Invocation.method(#getWebsiteDataStore, []), - ), - ), - ) as _i3.Future<_i2.WKWebsiteDataStore>); + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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, + _i3.Future<_i2.WKPreferences> getPreferences() => + (super.noSuchMethod( Invocation.method(#getPreferences, []), - ), - ), - ) as _i3.Future<_i2.WKPreferences>); + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future setMediaTypesRequiringUserActionForPlayback( _i2.AudiovisualMediaType? type, ) => (super.noSuchMethod( - Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ - type, - ]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); @override _i3.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( - Invocation.method(#getDefaultWebpagePreferences, []), - returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_5( - this, Invocation.method(#getDefaultWebpagePreferences, []), - ), - ), - ) as _i3.Future<_i2.WKWebpagePreferences>); + returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_5( + this, + Invocation.method(#getDefaultWebpagePreferences, []), + ), + ), + ) + as _i3.Future<_i2.WKWebpagePreferences>); @override - _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebViewConfiguration_6( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.WKWebViewConfiguration); + _i2.WKWebViewConfiguration pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebViewConfiguration_6( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.WKWebViewConfiguration); @override _i3.Future addObserver( @@ -299,18 +326,20 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } /// A class which mocks [UIScrollViewDelegate]. @@ -323,22 +352,26 @@ class MockUIScrollViewDelegate extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => + (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) + as _i2.PigeonInstanceManager); @override - _i2.UIScrollViewDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeUIScrollViewDelegate_7( - this, - Invocation.method(#pigeon_copy, []), - ), - ) as _i2.UIScrollViewDelegate); + _i2.UIScrollViewDelegate pigeon_copy() => + (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollViewDelegate_7( + this, + Invocation.method(#pigeon_copy, []), + ), + ) + as _i2.UIScrollViewDelegate); @override _i3.Future addObserver( @@ -347,16 +380,18 @@ class MockUIScrollViewDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) + as _i3.Future); } From efd2ad917e10b2020b59867eef086be080590a4f Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 22:33:32 -0400 Subject: [PATCH 22/34] add internal and error --- .../WebKitLibrary.g.swift | 4148 +---------------- .../lib/src/common/web_kit.g.dart | 264 -- .../lib/src/webkit_ssl_auth_error.dart | 4 + .../webview_flutter_wkwebview/pubspec.yaml | 7 +- 4 files changed, 183 insertions(+), 4240 deletions(-) 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 d3850f328a71..9cb7aaae02e4 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 @@ -1678,188 +1678,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URLRequest`. -/// -/// 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 URLRequestWrapperProxyAPIDelegate : PigeonApiDelegateURLRequest { - func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws -> URLRequestWrapper { - return URLRequest(,url: url) - } - - func getUrl(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? { - return pigeonInstance.url - } - - func setHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws { - pigeonInstance.httpMethod = method: method - } - - func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? { - return pigeonInstance.httpMethod - } - - func setHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, body: FlutterStandardTypedData?) throws { - pigeonInstance.httpBody = body: body - } - - func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> FlutterStandardTypedData? { - return pigeonInstance.httpBody - } - - func setAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) throws { - pigeonInstance.allHttpHeaderFields = fields: fields - } - - func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> [String: String]? { - return pigeonInstance.allHttpHeaderFields - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLRequestWrapperProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: "myString") - XCTAssertNotNil(instance) - } - - func testGetUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getUrlCalled) - XCTAssertEqual(value, instance.getUrl()) - } - - func testSetHttpMethod() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let method = "myString" - api.pigeonDelegate.setHttpMethod(pigeonApi: api, pigeonInstance: instance, method: method) - - XCTAssertEqual(instance.setHttpMethodArgs, [method]) - } - - func testGetHttpMethod() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let value = api.pigeonDelegate.getHttpMethod(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getHttpMethodCalled) - XCTAssertEqual(value, instance.getHttpMethod()) - } - - func testSetHttpBody() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let body = byteArrayOf(0xA1.toByte()) - api.pigeonDelegate.setHttpBody(pigeonApi: api, pigeonInstance: instance, body: body) - - XCTAssertEqual(instance.setHttpBodyArgs, [body]) - } - - func testGetHttpBody() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let value = api.pigeonDelegate.getHttpBody(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getHttpBodyCalled) - XCTAssertEqual(value, instance.getHttpBody()) - } - - func testSetAllHttpHeaderFields() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let fields = ["myString": "myString"] - api.pigeonDelegate.setAllHttpHeaderFields(pigeonApi: api, pigeonInstance: instance, fields: fields) - - XCTAssertEqual(instance.setAllHttpHeaderFieldsArgs, [fields]) - } - - func testGetAllHttpHeaderFields() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let value = api.pigeonDelegate.getAllHttpHeaderFields(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getAllHttpHeaderFieldsCalled) - XCTAssertEqual(value, instance.getAllHttpHeaderFields()) - } - -} -class TestURLRequestWrapper: URLRequest { - var getUrlCalled = false - var setHttpMethodArgs: [AnyHashable?]? = nil - var getHttpMethodCalled = false - var setHttpBodyArgs: [AnyHashable?]? = nil - var getHttpBodyCalled = false - var setAllHttpHeaderFieldsArgs: [AnyHashable?]? = nil - var getAllHttpHeaderFieldsCalled = false - - - override func getUrl() { - getUrlCalled = true - } - override func setHttpMethod() { - setHttpMethodArgs = [method] - } - override func getHttpMethod() { - getHttpMethodCalled = true - } - override func setHttpBody() { - setHttpBodyArgs = [body] - } - override func getHttpBody() { - getHttpBodyCalled = true - } - override func setAllHttpHeaderFields() { - setAllHttpHeaderFieldsArgs = [fields] - } - override func getAllHttpHeaderFields() { - getAllHttpHeaderFieldsCalled = true - } -} -*/ - protocol PigeonApiDelegateHTTPURLResponse { /// The response’s HTTP status code. func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 @@ -1914,53 +1732,6 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `HTTPURLResponse`. -/// -/// 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 HTTPURLResponseProxyAPIDelegate : PigeonApiDelegateHTTPURLResponse { - func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 { - return pigeonInstance.statusCode - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class HTTPURLResponseProxyAPITests: XCTestCase { - func testStatusCode() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiHTTPURLResponse(registrar) - - let instance = TestHTTPURLResponse() - let value = try? api.pigeonDelegate.statusCode(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.statusCode) - } - -} -*/ - open class PigeonApiDelegateURLResponse { } @@ -2104,100 +1875,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKUserScript`. -/// -/// 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 UserScriptProxyAPIDelegate : PigeonApiDelegateWKUserScript { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, isForMainFrameOnly: Bool) throws -> WKUserScript { - return WKUserScript() - } - - func source(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> String { - return pigeonInstance.source - } - - func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> UserScriptInjectionTime { - switch pigeonInstance.injectionTime { - case .atDocumentStart: - return .atDocumentStart - case .atDocumentEnd: - return .atDocumentEnd - @unknown default: - return .unknown - } - } - - func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> Bool { - return pigeonInstance.isForMainFrameOnly - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class UserScriptProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api source: "myString", injectionTime: .atDocumentStart, isForMainFrameOnly: true) - XCTAssertNotNil(instance) - } - - func testSource() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) - - let instance = TestUserScript() - let value = try? api.pigeonDelegate.source(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.source) - } - - func testInjectionTime() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) - - let instance = TestUserScript() - let value = try? api.pigeonDelegate.injectionTime(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.injectionTime) - } - - func testIsForMainFrameOnly() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) - - let instance = TestUserScript() - let value = try? api.pigeonDelegate.isForMainFrameOnly(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.isForMainFrameOnly) - } - -} -*/ - protocol PigeonApiDelegateWKNavigationAction { /// The URL request object associated with the navigation action. func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper @@ -2260,96 +1937,6 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKNavigationAction`. -/// -/// 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 NavigationActionProxyAPIDelegate : PigeonApiDelegateWKNavigationAction { - func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper { - return pigeonInstance.request - } - - func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> WKFrameInfo? { - return pigeonInstance.targetFrame - } - - func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> NavigationType { - switch pigeonInstance.navigationType { - case .linkActivated: - return .linkActivated - case .formSubmitted: - return .formSubmitted - case .backForward: - return .backForward - case .reload: - return .reload - case .formResubmitted: - return .formResubmitted - case .other: - return .other - @unknown default: - return .unknown - } - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class NavigationActionProxyAPITests: XCTestCase { - func testRequest() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) - - let instance = TestNavigationAction() - let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.request) - } - - func testTargetFrame() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) - - let instance = TestNavigationAction() - let value = try? api.pigeonDelegate.targetFrame(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.targetFrame) - } - - func testNavigationType() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) - - let instance = TestNavigationAction() - let value = try? api.pigeonDelegate.navigationType(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.navigationType) - } - -} -*/ - protocol PigeonApiDelegateWKNavigationResponse { /// The frame’s response. func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse @@ -2408,67 +1995,6 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKNavigationResponse`. -/// -/// 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 NavigationResponseProxyAPIDelegate : PigeonApiDelegateWKNavigationResponse { - func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse { - return pigeonInstance.response - } - - func isForMainFrame(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> Bool { - return pigeonInstance.isForMainFrame - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class NavigationResponseProxyAPITests: XCTestCase { - func testResponse() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationResponse(registrar) - - let instance = TestNavigationResponse() - let value = try? api.pigeonDelegate.response(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.response) - } - - func testIsForMainFrame() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationResponse(registrar) - - let instance = TestNavigationResponse() - let value = try? api.pigeonDelegate.isForMainFrame(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.isForMainFrame) - } - -} -*/ - protocol PigeonApiDelegateWKFrameInfo { /// A Boolean value indicating whether the frame is the web site's main frame /// or a subframe. @@ -2527,67 +2053,6 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKFrameInfo`. -/// -/// 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 FrameInfoProxyAPIDelegate : PigeonApiDelegateWKFrameInfo { - func isMainFrame(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> Bool { - return pigeonInstance.isMainFrame - } - - func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> URLRequestWrapper? { - return pigeonInstance.request - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class FrameInfoProxyAPITests: XCTestCase { - func testIsMainFrame() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) - - let instance = TestFrameInfo() - let value = try? api.pigeonDelegate.isMainFrame(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.isMainFrame) - } - - func testRequest() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) - - let instance = TestFrameInfo() - let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.request) - } - -} -*/ - protocol PigeonApiDelegateNSError { /// The error code. func code(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> Int64 @@ -2648,81 +2113,6 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `NSError`. -/// -/// 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 ErrorProxyAPIDelegate : PigeonApiDelegateNSError { - func code(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> Int64 { - return pigeonInstance.code - } - - func domain(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> String { - return pigeonInstance.domain - } - - func userInfo(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> [String: Any?] { - return pigeonInstance.userInfo - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ErrorProxyAPITests: XCTestCase { - func testCode() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSError(registrar) - - let instance = TestError() - let value = try? api.pigeonDelegate.code(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.code) - } - - func testDomain() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSError(registrar) - - let instance = TestError() - let value = try? api.pigeonDelegate.domain(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.domain) - } - - func testUserInfo() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSError(registrar) - - let instance = TestError() - let value = try? api.pigeonDelegate.userInfo(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.userInfo) - } - -} -*/ - protocol PigeonApiDelegateWKScriptMessage { /// The name of the message handler to which the message is sent. func name(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> String @@ -2780,67 +2170,6 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKScriptMessage`. -/// -/// 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 ScriptMessageProxyAPIDelegate : PigeonApiDelegateWKScriptMessage { - func name(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> String { - return pigeonInstance.name - } - - func body(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> Any? { - return pigeonInstance.body - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ScriptMessageProxyAPITests: XCTestCase { - func testName() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKScriptMessage(registrar) - - let instance = TestScriptMessage() - let value = try? api.pigeonDelegate.name(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.name) - } - - func testBody() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKScriptMessage(registrar) - - let instance = TestScriptMessage() - let value = try? api.pigeonDelegate.body(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.body) - } - -} -*/ - protocol PigeonApiDelegateWKSecurityOrigin { /// The security origin’s host. func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String @@ -2901,81 +2230,6 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKSecurityOrigin`. -/// -/// 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 SecurityOriginProxyAPIDelegate : PigeonApiDelegateWKSecurityOrigin { - func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String { - return pigeonInstance.host - } - - func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 { - return pigeonInstance.port - } - - func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String { - return pigeonInstance.securityProtocol - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class SecurityOriginProxyAPITests: XCTestCase { - func testHost() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) - - let instance = TestSecurityOrigin() - let value = try? api.pigeonDelegate.host(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.host) - } - - func testPort() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) - - let instance = TestSecurityOrigin() - let value = try? api.pigeonDelegate.port(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.port) - } - - func testSecurityProtocol() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) - - let instance = TestSecurityOrigin() - let value = try? api.pigeonDelegate.securityProtocol(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.securityProtocol) - } - -} -*/ - protocol PigeonApiDelegateHTTPCookie { func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie /// The cookie’s properties. @@ -3071,74 +2325,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `HTTPCookie`. -/// -/// 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 HTTPCookieProxyAPIDelegate : PigeonApiDelegateHTTPCookie { - func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie { - return HTTPCookie(,properties: properties) - } - - func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws -> [HttpCookiePropertyKey: Any]? { - return pigeonInstance.properties - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class HTTPCookieProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiHTTPCookie(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, properties: [.comment: -1]) - XCTAssertNotNil(instance) - } - - func testGetProperties() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiHTTPCookie(registrar) - - let instance = TestHTTPCookie() - let value = api.pigeonDelegate.getProperties(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getPropertiesCalled) - XCTAssertEqual(value, instance.getProperties()) - } - -} -class TestHTTPCookie: HTTPCookie { - var getPropertiesCalled = false - - - override func getProperties() { - getPropertiesCalled = true - } -} -*/ - protocol PigeonApiDelegateAuthenticationChallengeResponse { func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse /// The option to use to handle the challenge. @@ -3220,90 +2406,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `AuthenticationChallengeResponse`. -/// -/// 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 AuthenticationChallengeResponseProxyAPIDelegate : PigeonApiDelegateAuthenticationChallengeResponse { - func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse { - return AuthenticationChallengeResponse() - } - - func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition { - switch pigeonInstance.disposition { - case .useCredential: - return .useCredential - case .performDefaultHandling: - return .performDefaultHandling - case .cancelAuthenticationChallenge: - return .cancelAuthenticationChallenge - case .rejectProtectionSpace: - return .rejectProtectionSpace - @unknown default: - return .unknown - } - } - - func credential(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> URLCredential? { - return pigeonInstance.credential - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class AuthenticationChallengeResponseProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api disposition: .useCredential, credential: TestURLCredential) - XCTAssertNotNil(instance) - } - - func testDisposition() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) - - let instance = TestAuthenticationChallengeResponse() - let value = try? api.pigeonDelegate.disposition(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.disposition) - } - - func testCredential() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) - - let instance = TestAuthenticationChallengeResponse() - let value = try? api.pigeonDelegate.credential(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.credential) - } - -} -*/ - protocol PigeonApiDelegateWKWebsiteDataStore { /// The default data store, which stores data persistently to disk. func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore) throws -> WKWebsiteDataStore @@ -3419,87 +2521,6 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKWebsiteDataStore`. -/// -/// 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 WebsiteDataStoreProxyAPIDelegate : PigeonApiDelegateWKWebsiteDataStore { - func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore): WKWebsiteDataStore { - return WKWebsiteDataStore.defaultDataStore - } - - func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore): WKHTTPCookieStore { - return pigeonInstance.httpCookieStore - } - - func removeDataOfTypes(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, completion: @escaping (Result) -> Void) { - return pigeonInstance.removeDataOfTypes(dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebsiteDataStoreProxyAPITests: XCTestCase { - func testHttpCookieStore() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebsiteDataStore(registrar) - - let instance = TestWebsiteDataStore() - let value = try? api.pigeonDelegate.httpCookieStore(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.httpCookieStore) - } - - func testRemoveDataOfTypes() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebsiteDataStore(registrar) - - let instance = TestWebsiteDataStore() - let dataTypes = [.cookies] - let modificationTimeInSecondsSinceEpoch = 1.0 - let value = api.pigeonDelegate.removeDataOfTypes(pigeonApi: api, pigeonInstance: instance, dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch) - - XCTAssertEqual(instance.removeDataOfTypesArgs, [dataTypes, modificationTimeInSecondsSinceEpoch]) - XCTAssertEqual(value, instance.removeDataOfTypes(dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch)) - } - -} -class TestWebsiteDataStore: WKWebsiteDataStore { - private var httpCookieStoreTestValue = TestHTTPCookieStore - var removeDataOfTypesArgs: [AnyHashable?]? = nil - - override var httpCookieStore: WKHTTPCookieStore { - return httpCookieStoreTestValue - } - - override func removeDataOfTypes() { - removeDataOfTypesArgs = [dataTypes, modificationTimeInSecondsSinceEpoch] - return true - } -} -*/ - protocol PigeonApiDelegateUIView { #if !os(macOS) /// The view’s background color. @@ -3605,81 +2626,6 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { } #endif } - -/* -// 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 Foundation -import UIKit - - -/// ProxyApi implementation for `UIView`. -/// -/// 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 ViewProxyAPIDelegate : PigeonApiDelegateUIView { - func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) throws { - pigeonInstance.backgroundColor = value: value - } - - func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws { - pigeonInstance.opaque = opaque: opaque - } - -} -*/ - -/* -// 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 UIKit -import Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ViewProxyAPITests: XCTestCase { - func testSetBackgroundColor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIView(registrar) - - let instance = TestView() - let value = 0 - api.pigeonDelegate.setBackgroundColor(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setBackgroundColorArgs, [value]) - } - - func testSetOpaque() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIView(registrar) - - let instance = TestView() - let opaque = true - api.pigeonDelegate.setOpaque(pigeonApi: api, pigeonInstance: instance, opaque: opaque) - - XCTAssertEqual(instance.setOpaqueArgs, [opaque]) - } - -} -class TestView: UIView { - var setBackgroundColorArgs: [AnyHashable?]? = nil - var setOpaqueArgs: [AnyHashable?]? = nil - - - override func setBackgroundColor() { - setBackgroundColorArgs = [value] - } - override func setOpaque() { - setOpaqueArgs = [opaque] - } -} -*/ - protocol PigeonApiDelegateUIScrollView { #if !os(macOS) /// The point at which the origin of the content view is offset from the @@ -3956,216 +2902,6 @@ final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { } #endif } - -/* -// 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 Foundation -import UIKit - - -/// ProxyApi implementation for `UIScrollView`. -/// -/// 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 ScrollViewProxyAPIDelegate : PigeonApiDelegateUIScrollView { - func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws -> [Double] { - return pigeonInstance.contentOffset - } - - func scrollBy(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws { - pigeonInstance.scrollBy(x: x, y: y) - } - - func setContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws { - pigeonInstance.setContentOffset(x: x, y: y) - } - - func setDelegate(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, delegate: UIScrollViewDelegate?) throws { - pigeonInstance.delegate = delegate: delegate - } - - func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.bounces = value: value - } - - func setBouncesHorizontally(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.bouncesHorizontally = value: value - } - - func setBouncesVertically(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.bouncesVertically = value: value - } - - func setAlwaysBounceVertical(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.alwaysBounceVertical = value: value - } - - func setAlwaysBounceHorizontal(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.alwaysBounceHorizontal = value: value - } - -} -*/ - -/* -// 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 UIKit -import Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ScrollViewProxyAPITests: XCTestCase { - func testGetContentOffset() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = api.pigeonDelegate.getContentOffset(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getContentOffsetCalled) - XCTAssertEqual(value, instance.getContentOffset()) - } - - func testScrollBy() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let x = 1.0 - let y = 1.0 - api.pigeonDelegate.scrollBy(pigeonApi: api, pigeonInstance: instance, x: x, y: y) - - XCTAssertEqual(instance.scrollByArgs, [x, y]) - } - - func testSetContentOffset() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let x = 1.0 - let y = 1.0 - api.pigeonDelegate.setContentOffset(pigeonApi: api, pigeonInstance: instance, x: x, y: y) - - XCTAssertEqual(instance.setContentOffsetArgs, [x, y]) - } - - func testSetDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let delegate = TestScrollViewDelegate - api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setDelegateArgs, [delegate]) - } - - func testSetBounces() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setBounces(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setBouncesArgs, [value]) - } - - func testSetBouncesHorizontally() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setBouncesHorizontally(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setBouncesHorizontallyArgs, [value]) - } - - func testSetBouncesVertically() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setBouncesVertically(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setBouncesVerticallyArgs, [value]) - } - - func testSetAlwaysBounceVertical() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setAlwaysBounceVertical(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setAlwaysBounceVerticalArgs, [value]) - } - - func testSetAlwaysBounceHorizontal() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setAlwaysBounceHorizontal(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setAlwaysBounceHorizontalArgs, [value]) - } - -} -class TestScrollView: UIScrollView { - var getContentOffsetCalled = false - var scrollByArgs: [AnyHashable?]? = nil - var setContentOffsetArgs: [AnyHashable?]? = nil - var setDelegateArgs: [AnyHashable?]? = nil - var setBouncesArgs: [AnyHashable?]? = nil - var setBouncesHorizontallyArgs: [AnyHashable?]? = nil - var setBouncesVerticallyArgs: [AnyHashable?]? = nil - var setAlwaysBounceVerticalArgs: [AnyHashable?]? = nil - var setAlwaysBounceHorizontalArgs: [AnyHashable?]? = nil - - - override func getContentOffset() { - getContentOffsetCalled = true - } - override func scrollBy() { - scrollByArgs = [x, y] - } - override func setContentOffset() { - setContentOffsetArgs = [x, y] - } - override func setDelegate() { - setDelegateArgs = [delegate] - } - override func setBounces() { - setBouncesArgs = [value] - } - override func setBouncesHorizontally() { - setBouncesHorizontallyArgs = [value] - } - override func setBouncesVertically() { - setBouncesVerticallyArgs = [value] - } - override func setAlwaysBounceVertical() { - setAlwaysBounceVerticalArgs = [value] - } - override func setAlwaysBounceHorizontal() { - setAlwaysBounceHorizontalArgs = [value] - } -} -*/ - protocol PigeonApiDelegateWKWebViewConfiguration { func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration /// The object that coordinates interactions between your app’s native code @@ -4442,245 +3178,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKWebViewConfiguration`. -/// -/// 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 WebViewConfigurationProxyAPIDelegate : PigeonApiDelegateWKWebViewConfiguration { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration { - return WKWebViewConfiguration() - } - - func setUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, controller: WKUserContentController) throws { - pigeonInstance.userContentController = controller: controller - } - - func getUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKUserContentController { - return pigeonInstance.userContentController - } - - func setWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, dataStore: WKWebsiteDataStore) throws { - pigeonInstance.websiteDataStore = dataStore: dataStore - } - - func getWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebsiteDataStore { - return pigeonInstance.websiteDataStore - } - - func setPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, preferences: WKPreferences) throws { - pigeonInstance.preferences = preferences: preferences - } - - func getPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKPreferences { - return pigeonInstance.preferences - } - - func setAllowsInlineMediaPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) throws { - pigeonInstance.allowsInlineMediaPlayback = allow: allow - } - - func setLimitsNavigationsToAppBoundDomains(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) throws { - pigeonInstance.limitsNavigationsToAppBoundDomains = limit: limit - } - - func setMediaTypesRequiringUserActionForPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, type: AudiovisualMediaType) throws { - pigeonInstance.mediaTypesRequiringUserActionForPlayback = type: type - } - - func getDefaultWebpagePreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebpagePreferences { - return pigeonInstance.defaultWebpagePreferences - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebViewConfigurationProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testSetUserContentController() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let controller = TestUserContentController - api.pigeonDelegate.setUserContentController(pigeonApi: api, pigeonInstance: instance, controller: controller) - - XCTAssertEqual(instance.setUserContentControllerArgs, [controller]) - } - - func testGetUserContentController() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let value = api.pigeonDelegate.getUserContentController(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getUserContentControllerCalled) - XCTAssertEqual(value, instance.getUserContentController()) - } - - func testSetWebsiteDataStore() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let dataStore = TestWebsiteDataStore - api.pigeonDelegate.setWebsiteDataStore(pigeonApi: api, pigeonInstance: instance, dataStore: dataStore) - - XCTAssertEqual(instance.setWebsiteDataStoreArgs, [dataStore]) - } - - func testGetWebsiteDataStore() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let value = api.pigeonDelegate.getWebsiteDataStore(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getWebsiteDataStoreCalled) - XCTAssertEqual(value, instance.getWebsiteDataStore()) - } - - func testSetPreferences() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let preferences = TestPreferences - api.pigeonDelegate.setPreferences(pigeonApi: api, pigeonInstance: instance, preferences: preferences) - - XCTAssertEqual(instance.setPreferencesArgs, [preferences]) - } - - func testGetPreferences() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let value = api.pigeonDelegate.getPreferences(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getPreferencesCalled) - XCTAssertEqual(value, instance.getPreferences()) - } - - func testSetAllowsInlineMediaPlayback() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let allow = true - api.pigeonDelegate.setAllowsInlineMediaPlayback(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsInlineMediaPlaybackArgs, [allow]) - } - - func testSetLimitsNavigationsToAppBoundDomains() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let limit = true - api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains(pigeonApi: api, pigeonInstance: instance, limit: limit) - - XCTAssertEqual(instance.setLimitsNavigationsToAppBoundDomainsArgs, [limit]) - } - - func testSetMediaTypesRequiringUserActionForPlayback() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let type = .none - api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback(pigeonApi: api, pigeonInstance: instance, type: type) - - XCTAssertEqual(instance.setMediaTypesRequiringUserActionForPlaybackArgs, [type]) - } - - func testGetDefaultWebpagePreferences() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let value = api.pigeonDelegate.getDefaultWebpagePreferences(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getDefaultWebpagePreferencesCalled) - XCTAssertEqual(value, instance.getDefaultWebpagePreferences()) - } - -} -class TestWebViewConfiguration: WKWebViewConfiguration { - var setUserContentControllerArgs: [AnyHashable?]? = nil - var getUserContentControllerCalled = false - var setWebsiteDataStoreArgs: [AnyHashable?]? = nil - var getWebsiteDataStoreCalled = false - var setPreferencesArgs: [AnyHashable?]? = nil - var getPreferencesCalled = false - var setAllowsInlineMediaPlaybackArgs: [AnyHashable?]? = nil - var setLimitsNavigationsToAppBoundDomainsArgs: [AnyHashable?]? = nil - var setMediaTypesRequiringUserActionForPlaybackArgs: [AnyHashable?]? = nil - var getDefaultWebpagePreferencesCalled = false - - - override func setUserContentController() { - setUserContentControllerArgs = [controller] - } - override func getUserContentController() { - getUserContentControllerCalled = true - } - override func setWebsiteDataStore() { - setWebsiteDataStoreArgs = [dataStore] - } - override func getWebsiteDataStore() { - getWebsiteDataStoreCalled = true - } - override func setPreferences() { - setPreferencesArgs = [preferences] - } - override func getPreferences() { - getPreferencesCalled = true - } - override func setAllowsInlineMediaPlayback() { - setAllowsInlineMediaPlaybackArgs = [allow] - } - override func setLimitsNavigationsToAppBoundDomains() { - setLimitsNavigationsToAppBoundDomainsArgs = [limit] - } - override func setMediaTypesRequiringUserActionForPlayback() { - setMediaTypesRequiringUserActionForPlaybackArgs = [type] - } - override func getDefaultWebpagePreferences() { - getDefaultWebpagePreferencesCalled = true - } -} -*/ - protocol PigeonApiDelegateWKUserContentController { /// Installs a message handler that you can call from your JavaScript code. func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws @@ -4804,164 +3301,33 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont 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.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(())) - } - } - } - } -} - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKUserContentController`. -/// -/// 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 UserContentControllerProxyAPIDelegate : PigeonApiDelegateWKUserContentController { - func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws { - pigeonInstance.addScriptMessageHandler(handler: handler, name: name) - } - - func removeScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, name: String) throws { - pigeonInstance.removeScriptMessageHandler(name: name) - } - - func removeAllScriptMessageHandlers(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws { - pigeonInstance.removeAllScriptMessageHandlers() - } - - func addUserScript(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, userScript: WKUserScript) throws { - pigeonInstance.addUserScript(userScript: userScript) - } - - func removeAllUserScripts(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws { - pigeonInstance.removeAllUserScripts() - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class UserContentControllerProxyAPITests: XCTestCase { - func testAddScriptMessageHandler() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - let handler = TestScriptMessageHandler - let name = "myString" - api.pigeonDelegate.addScriptMessageHandler(pigeonApi: api, pigeonInstance: instance, handler: handler, name: name) - - XCTAssertEqual(instance.addScriptMessageHandlerArgs, [handler, name]) - } - - func testRemoveScriptMessageHandler() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - let name = "myString" - api.pigeonDelegate.removeScriptMessageHandler(pigeonApi: api, pigeonInstance: instance, name: name) - - XCTAssertEqual(instance.removeScriptMessageHandlerArgs, [name]) - } - - func testRemoveAllScriptMessageHandlers() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - api.pigeonDelegate.removeAllScriptMessageHandlers(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.removeAllScriptMessageHandlersCalled) - } - - func testAddUserScript() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - let userScript = TestUserScript - api.pigeonDelegate.addUserScript(pigeonApi: api, pigeonInstance: instance, userScript: userScript) - - XCTAssertEqual(instance.addUserScriptArgs, [userScript]) - } - - func testRemoveAllUserScripts() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - api.pigeonDelegate.removeAllUserScripts(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.removeAllUserScriptsCalled) - } - -} -class TestUserContentController: WKUserContentController { - var addScriptMessageHandlerArgs: [AnyHashable?]? = nil - var removeScriptMessageHandlerArgs: [AnyHashable?]? = nil - var removeAllScriptMessageHandlersCalled = false - var addUserScriptArgs: [AnyHashable?]? = nil - var removeAllUserScriptsCalled = false - - - override func addScriptMessageHandler() { - addScriptMessageHandlerArgs = [handler, name] - } - override func removeScriptMessageHandler() { - removeScriptMessageHandlerArgs = [name] - } - override func removeAllScriptMessageHandlers() { - removeAllScriptMessageHandlersCalled = true - } - override func addUserScript() { - addUserScriptArgs = [userScript] - } - override func removeAllUserScripts() { - removeAllUserScriptsCalled = true + 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.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(())) + } + } + } } } -*/ - protocol PigeonApiDelegateWKPreferences { /// A Boolean value that indicates whether JavaScript is enabled. func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws @@ -5039,62 +3405,6 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKPreferences`. -/// -/// 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 PreferencesProxyAPIDelegate : PigeonApiDelegateWKPreferences { - func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws { - pigeonInstance.javaScriptEnabled = enabled: enabled - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class PreferencesProxyAPITests: XCTestCase { - func testSetJavaScriptEnabled() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKPreferences(registrar) - - let instance = TestPreferences() - let enabled = true - api.pigeonDelegate.setJavaScriptEnabled(pigeonApi: api, pigeonInstance: instance, enabled: enabled) - - XCTAssertEqual(instance.setJavaScriptEnabledArgs, [enabled]) - } - -} -class TestPreferences: WKPreferences { - var setJavaScriptEnabledArgs: [AnyHashable?]? = nil - - - override func setJavaScriptEnabled() { - setJavaScriptEnabledArgs = [enabled] - } -} -*/ - protocol PigeonApiDelegateWKScriptMessageHandler { func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler } @@ -5190,80 +3500,6 @@ withIdentifier: pigeonIdentifierArg) } } - -/* -// 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 Foundation -import WebKit - -/// Implementation of `WKScriptMessageHandler` that calls to Dart in callback methods. -class ScriptMessageHandlerImpl: WKScriptMessageHandler { - let api: PigeonApiProtocolWKScriptMessageHandler - - init(api: PigeonApiProtocolWKScriptMessageHandler) { - self.api = api - } - - func fixMe() { - api.didReceiveScriptMessage(pigeonInstance: self, controller: controller, message: message) { _ in } - } -} - -/// ProxyApi implementation for `WKScriptMessageHandler`. -/// -/// 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 ScriptMessageHandlerProxyAPIDelegate : PigeonApiDelegateWKScriptMessageHandler { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler { - return WKScriptMessageHandlerImpl(api: pigeonApi) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ScriptMessageHandlerProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKScriptMessageHandler(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testDidReceiveScriptMessage() { - let api = TestScriptMessageHandlerApi() - let instance = ScriptMessageHandlerImpl(api: api) - let controller = TestUserContentController - let message = TestScriptMessage - instance.didReceiveScriptMessage(controller: controller, message: message) - - XCTAssertEqual(api.didReceiveScriptMessageArgs, [controller, message]) - } - -} -class TestScriptMessageHandlerApi: PigeonApiProtocolWKScriptMessageHandler { - var didReceiveScriptMessageArgs: [AnyHashable?]? = nil - - func didReceiveScriptMessage(controller: WKUserContentController, message: WKScriptMessage) throws { - didReceiveScriptMessageArgs = [controllerArg, messageArg] - } -} -*/ - protocol PigeonApiDelegateWKNavigationDelegate { func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate } @@ -5618,205 +3854,6 @@ withIdentifier: pigeonIdentifierArg) } } - -/* -// 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 Foundation -import WebKit - -/// Implementation of `WKNavigationDelegate` that calls to Dart in callback methods. -class NavigationDelegateImpl: WKNavigationDelegate { - let api: PigeonApiProtocolWKNavigationDelegate - - init(api: PigeonApiProtocolWKNavigationDelegate) { - self.api = api - } - - func fixMe() { - api.didFinishNavigation(pigeonInstance: self, webView: webView, url: url) { _ in } - } - - func fixMe() { - api.didStartProvisionalNavigation(pigeonInstance: self, webView: webView, url: url) { _ in } - } - - func fixMe() { - api.decidePolicyForNavigationAction(pigeonInstance: self, webView: webView, navigationAction: navigationAction) { _ in } - } - - func fixMe() { - api.decidePolicyForNavigationResponse(pigeonInstance: self, webView: webView, navigationResponse: navigationResponse) { _ in } - } - - func fixMe() { - api.didFailNavigation(pigeonInstance: self, webView: webView, error: error) { _ in } - } - - func fixMe() { - api.didFailProvisionalNavigation(pigeonInstance: self, webView: webView, error: error) { _ in } - } - - func fixMe() { - api.webViewWebContentProcessDidTerminate(pigeonInstance: self, webView: webView) { _ in } - } - - func fixMe() { - api.didReceiveAuthenticationChallenge(pigeonInstance: self, webView: webView, challenge: challenge) { _ in } - } -} - -/// ProxyApi implementation for `WKNavigationDelegate`. -/// -/// 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 NavigationDelegateProxyAPIDelegate : PigeonApiDelegateWKNavigationDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate { - return WKNavigationDelegateImpl(api: pigeonApi) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class NavigationDelegateProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationDelegate(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testDidFinishNavigation() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let url = "myString" - instance.didFinishNavigation(webView: webView, url: url) - - XCTAssertEqual(api.didFinishNavigationArgs, [webView, url]) - } - - func testDidStartProvisionalNavigation() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let url = "myString" - instance.didStartProvisionalNavigation(webView: webView, url: url) - - XCTAssertEqual(api.didStartProvisionalNavigationArgs, [webView, url]) - } - - func testDecidePolicyForNavigationAction() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let navigationAction = TestNavigationAction - instance.decidePolicyForNavigationAction(webView: webView, navigationAction: navigationAction) - - XCTAssertEqual(api.decidePolicyForNavigationActionArgs, [webView, navigationAction]) - } - - func testDecidePolicyForNavigationResponse() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let navigationResponse = TestNavigationResponse - instance.decidePolicyForNavigationResponse(webView: webView, navigationResponse: navigationResponse) - - XCTAssertEqual(api.decidePolicyForNavigationResponseArgs, [webView, navigationResponse]) - } - - func testDidFailNavigation() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let error = TestError - instance.didFailNavigation(webView: webView, error: error) - - XCTAssertEqual(api.didFailNavigationArgs, [webView, error]) - } - - func testDidFailProvisionalNavigation() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let error = TestError - instance.didFailProvisionalNavigation(webView: webView, error: error) - - XCTAssertEqual(api.didFailProvisionalNavigationArgs, [webView, error]) - } - - func testWebViewWebContentProcessDidTerminate() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - instance.webViewWebContentProcessDidTerminate(webView: webView) - - XCTAssertEqual(api.webViewWebContentProcessDidTerminateArgs, [webView]) - } - - func testDidReceiveAuthenticationChallenge() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let challenge = TestURLAuthenticationChallenge - instance.didReceiveAuthenticationChallenge(webView: webView, challenge: challenge) - - XCTAssertEqual(api.didReceiveAuthenticationChallengeArgs, [webView, challenge]) - } - -} -class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate { - var didFinishNavigationArgs: [AnyHashable?]? = nil - var didStartProvisionalNavigationArgs: [AnyHashable?]? = nil - var decidePolicyForNavigationActionArgs: [AnyHashable?]? = nil - var decidePolicyForNavigationResponseArgs: [AnyHashable?]? = nil - var didFailNavigationArgs: [AnyHashable?]? = nil - var didFailProvisionalNavigationArgs: [AnyHashable?]? = nil - var webViewWebContentProcessDidTerminateArgs: [AnyHashable?]? = nil - var didReceiveAuthenticationChallengeArgs: [AnyHashable?]? = nil - - func didFinishNavigation(webView: WKWebView, url: String?) throws { - didFinishNavigationArgs = [webViewArg, urlArg] - } - func didStartProvisionalNavigation(webView: WKWebView, url: String?) throws { - didStartProvisionalNavigationArgs = [webViewArg, urlArg] - } - func decidePolicyForNavigationAction(webView: WKWebView, navigationAction: WKNavigationAction) throws -> NavigationActionPolicy { - decidePolicyForNavigationActionArgs = [webViewArg, navigationActionArg] - } - func decidePolicyForNavigationResponse(webView: WKWebView, navigationResponse: WKNavigationResponse) throws -> NavigationResponsePolicy { - decidePolicyForNavigationResponseArgs = [webViewArg, navigationResponseArg] - } - func didFailNavigation(webView: WKWebView, error: NSError) throws { - didFailNavigationArgs = [webViewArg, errorArg] - } - func didFailProvisionalNavigation(webView: WKWebView, error: NSError) throws { - didFailProvisionalNavigationArgs = [webViewArg, errorArg] - } - func webViewWebContentProcessDidTerminate(webView: WKWebView) throws { - webViewWebContentProcessDidTerminateArgs = [webViewArg] - } - func didReceiveAuthenticationChallenge(webView: WKWebView, challenge: URLAuthenticationChallenge) throws -> [Any?] { - didReceiveAuthenticationChallengeArgs = [webViewArg, challengeArg] - } -} -*/ - protocol PigeonApiDelegateNSObject { func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject /// Registers the observer object to receive KVO notifications for the key @@ -5929,162 +3966,42 @@ withIdentifier: pigeonIdentifierArg) completion(.failure(PigeonError(code: code, message: message, details: details))) } else { completion(.success(())) - } - } - } - } - /// Informs the observing object when the value at the specified key path - /// relative to the observed object has changed. - func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.observeValue" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] 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(())) - } - } - } - -} - -/* -// 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 Foundation - - -/// Implementation of `NSObject` that calls to Dart in callback methods. -class ObjectImpl: NSObject { - let api: PigeonApiProtocolNSObject - - init(api: PigeonApiProtocolNSObject) { - self.api = api - } - - func fixMe() { - api.observeValue(pigeonInstance: self, keyPath: keyPath, object: object, change: change) { _ in } - } -} - -/// ProxyApi implementation for `NSObject`. -/// -/// 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 ObjectProxyAPIDelegate : PigeonApiDelegateNSObject { - func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject { - return NSObjectImpl(api: pigeonApi) - } - - func addObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, options: [KeyValueObservingOptions]) throws { - pigeonInstance.addObserver(observer: observer, keyPath: keyPath, options: options) - } - - func removeObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) throws { - pigeonInstance.removeObserver(observer: observer, keyPath: keyPath) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ObjectProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSObject(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testAddObserver() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSObject(registrar) - - let instance = TestObject() - let observer = TestObject - let keyPath = "myString" - let options = [.newValue] - api.pigeonDelegate.addObserver(pigeonApi: api, pigeonInstance: instance, observer: observer, keyPath: keyPath, options: options) - - XCTAssertEqual(instance.addObserverArgs, [observer, keyPath, options]) - } - - func testRemoveObserver() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSObject(registrar) - - let instance = TestObject() - let observer = TestObject - let keyPath = "myString" - api.pigeonDelegate.removeObserver(pigeonApi: api, pigeonInstance: instance, observer: observer, keyPath: keyPath) - - XCTAssertEqual(instance.removeObserverArgs, [observer, keyPath]) - } - - func testObserveValue() { - let api = TestObjectApi() - let instance = ObjectImpl(api: api) - let keyPath = "myString" - let object = TestObject - let change = [.indexes: -1] - instance.observeValue(keyPath: keyPath, object: object, change: change) - - XCTAssertEqual(api.observeValueArgs, [keyPath, object, change]) - } - -} -class TestObject: NSObject { - var addObserverArgs: [AnyHashable?]? = nil - var removeObserverArgs: [AnyHashable?]? = nil - - - override func addObserver() { - addObserverArgs = [observer, keyPath, options] + } + } + } } - override func removeObserver() { - removeObserverArgs = [observer, keyPath] + /// Informs the observing object when the value at the specified key path + /// relative to the observed object has changed. + func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) { + if pigeonRegistrar.ignoreCallsToDart { + completion( + .failure( + PigeonError( + code: "ignore-calls-error", + message: "Calls to Dart are being ignored.", details: ""))) + return + } + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.observeValue" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] 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(())) + } + } } -} -class TestObjectApi: PigeonApiProtocolNSObject { - var observeValueArgs: [AnyHashable?]? = nil - func observeValue(keyPath: String?, object: NSObject?, change: [KeyValueChangeKey: Any?]?) throws { - observeValueArgs = [keyPathArg, objectArg, changeArg] - } } -*/ - protocol PigeonApiDelegateUIViewWKWebView { #if !os(macOS) func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView @@ -6622,514 +4539,46 @@ withIdentifier: pigeonIdentifierArg) } } } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) - } - #endif - } - - #if !os(macOS) - ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) - } - } - } - } - #endif -} - -/* -// 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 Foundation -import UIKit -import WebKit - - -/// ProxyApi implementation for `UIViewWKWebView`. -/// -/// 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 WebViewProxyAPIDelegate : PigeonApiDelegateUIViewWKWebView { - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView { - return UIViewWKWebView(,initialConfiguration: initialConfiguration) - } - - func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: UIViewWKWebView): WKWebViewConfiguration { - return pigeonInstance.configuration - } - - func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: UIViewWKWebView): UIScrollView { - return pigeonInstance.scrollView - } - - func setUIDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws { - pigeonInstance.uIDelegate = delegate: delegate - } - - func setNavigationDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws { - pigeonInstance.navigationDelegate = delegate: delegate - } - - func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.url - } - - func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Double { - return pigeonInstance.estimatedProgress - } - - func load(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws { - pigeonInstance.load(request: request) - } - - func loadHtmlString(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws { - pigeonInstance.loadHtmlString(string: string, baseUrl: baseUrl) - } - - func loadFileUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws { - pigeonInstance.loadFileUrl(url: url, readAccessUrl: readAccessUrl) - } - - func loadFlutterAsset(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws { - pigeonInstance.loadFlutterAsset(key: key) - } - - func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { - return pigeonInstance.canGoBack() - } - - func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { - return pigeonInstance.canGoForward() - } - - func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.goBack() - } - - func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.goForward() - } - - func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.reload() - } - - func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.title - } - - func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { - pigeonInstance.allowsBackForwardNavigationGestures = allow: allow - } - - func setCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws { - pigeonInstance.customUserAgent = userAgent: userAgent - } - - func evaluateJavaScript(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) { - return pigeonInstance.evaluateJavaScript(javaScriptString: javaScriptString) - } - - func setInspectable(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws { - pigeonInstance.inspectable = inspectable: inspectable - } - - func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.customUserAgent - } - - func setAllowsLinkPreview(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { - pigeonInstance.allowsLinkPreview = allow: allow - } - -} -*/ - -/* -// 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 UIKit -import WebKit -import Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebViewProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: TestWebViewConfiguration) - XCTAssertNotNil(instance) - } - - func testConfiguration() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = try? api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.configuration) - } - - func testScrollView() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = try? api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.scrollView) - } - - func testSetUIDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let delegate = TestUIDelegate - api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setUIDelegateArgs, [delegate]) - } - - func testSetNavigationDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let delegate = TestNavigationDelegate - api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setNavigationDelegateArgs, [delegate]) - } - - func testGetUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getUrlCalled) - XCTAssertEqual(value, instance.getUrl()) - } - - func testGetEstimatedProgress() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getEstimatedProgressCalled) - XCTAssertEqual(value, instance.getEstimatedProgress()) - } - - func testLoad() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let request = TestURLRequestWrapper - api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: instance, request: request) - - XCTAssertEqual(instance.loadArgs, [request]) - } - - func testLoadHtmlString() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let string = "myString" - let baseUrl = "myString" - api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: instance, string: string, baseUrl: baseUrl) - - XCTAssertEqual(instance.loadHtmlStringArgs, [string, baseUrl]) - } - - func testLoadFileUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let url = "myString" - let readAccessUrl = "myString" - api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: instance, url: url, readAccessUrl: readAccessUrl) - - XCTAssertEqual(instance.loadFileUrlArgs, [url, readAccessUrl]) - } - - func testLoadFlutterAsset() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let key = "myString" - api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: instance, key: key) - - XCTAssertEqual(instance.loadFlutterAssetArgs, [key]) - } - - func testCanGoBack() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.canGoBackCalled) - XCTAssertEqual(value, instance.canGoBack()) - } - - func testCanGoForward() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.canGoForwardCalled) - XCTAssertEqual(value, instance.canGoForward()) - } - - func testGoBack() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.goBackCalled) - } - - func testGoForward() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.goForwardCalled) - } - - func testReload() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.reloadCalled) - } - - func testGetTitle() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getTitleCalled) - XCTAssertEqual(value, instance.getTitle()) - } - - func testSetAllowsBackForwardNavigationGestures() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let allow = true - api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsBackForwardNavigationGesturesArgs, [allow]) - } - - func testSetCustomUserAgent() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let userAgent = "myString" - api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: instance, userAgent: userAgent) - - XCTAssertEqual(instance.setCustomUserAgentArgs, [userAgent]) - } - - func testEvaluateJavaScript() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let javaScriptString = "myString" - let value = api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: instance, javaScriptString: javaScriptString) - - XCTAssertEqual(instance.evaluateJavaScriptArgs, [javaScriptString]) - XCTAssertEqual(value, instance.evaluateJavaScript(javaScriptString: javaScriptString)) - } - - func testSetInspectable() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let inspectable = true - api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: instance, inspectable: inspectable) - - XCTAssertEqual(instance.setInspectableArgs, [inspectable]) - } - - func testGetCustomUserAgent() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getCustomUserAgentCalled) - XCTAssertEqual(value, instance.getCustomUserAgent()) - } - - func testSetAllowsLinkPreview() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let allow = true - api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsLinkPreviewArgs, [allow]) - } - -} -class TestWebView: UIViewWKWebView { - private var configurationTestValue = TestWebViewConfiguration - private var scrollViewTestValue = TestScrollView - var setUIDelegateArgs: [AnyHashable?]? = nil - var setNavigationDelegateArgs: [AnyHashable?]? = nil - var getUrlCalled = false - var getEstimatedProgressCalled = false - var loadArgs: [AnyHashable?]? = nil - var loadHtmlStringArgs: [AnyHashable?]? = nil - var loadFileUrlArgs: [AnyHashable?]? = nil - var loadFlutterAssetArgs: [AnyHashable?]? = nil - var canGoBackCalled = false - var canGoForwardCalled = false - var goBackCalled = false - var goForwardCalled = false - var reloadCalled = false - var getTitleCalled = false - var setAllowsBackForwardNavigationGesturesArgs: [AnyHashable?]? = nil - var setCustomUserAgentArgs: [AnyHashable?]? = nil - var evaluateJavaScriptArgs: [AnyHashable?]? = nil - var setInspectableArgs: [AnyHashable?]? = nil - var getCustomUserAgentCalled = false - var setAllowsLinkPreviewArgs: [AnyHashable?]? = nil - - override var configuration: WKWebViewConfiguration { - return configurationTestValue - } - override var scrollView: UIScrollView { - return scrollViewTestValue - } - - override func setUIDelegate() { - setUIDelegateArgs = [delegate] - } - override func setNavigationDelegate() { - setNavigationDelegateArgs = [delegate] - } - override func getUrl() { - getUrlCalled = true - } - override func getEstimatedProgress() { - getEstimatedProgressCalled = true - } - override func load() { - loadArgs = [request] - } - override func loadHtmlString() { - loadHtmlStringArgs = [string, baseUrl] - } - override func loadFileUrl() { - loadFileUrlArgs = [url, readAccessUrl] - } - override func loadFlutterAsset() { - loadFlutterAssetArgs = [key] - } - override func canGoBack() { - canGoBackCalled = true - } - override func canGoForward() { - canGoForwardCalled = true - } - override func goBack() { - goBackCalled = true - } - override func goForward() { - goForwardCalled = true - } - override func reload() { - reloadCalled = true - } - override func getTitle() { - getTitleCalled = true - } - override func setAllowsBackForwardNavigationGestures() { - setAllowsBackForwardNavigationGesturesArgs = [allow] - } - override func setCustomUserAgent() { - setCustomUserAgentArgs = [userAgent] - } - override func evaluateJavaScript() { - evaluateJavaScriptArgs = [javaScriptString] - return -1 - } - override func setInspectable() { - setInspectableArgs = [inspectable] - } - override func getCustomUserAgent() { - getCustomUserAgentCalled = true + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } + #endif } - override func setAllowsLinkPreview() { - setAllowsLinkPreviewArgs = [allow] + + #if !os(macOS) + ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + } + } + } } + #endif } -*/ - protocol PigeonApiDelegateNSViewWKWebView { #if !os(iOS) func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView @@ -7619,520 +5068,72 @@ withIdentifier: pigeonIdentifierArg) getCustomUserAgentChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } - } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) - } - #endif - #if !os(iOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) - } - #endif - } - - #if !os(iOS) - ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) - } - } - } - } - #endif -} - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `NSViewWKWebView`. -/// -/// 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 WebViewProxyAPIDelegate : PigeonApiDelegateNSViewWKWebView { - func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView { - return NSViewWKWebView(,initialConfiguration: initialConfiguration) - } - - func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: NSViewWKWebView): WKWebViewConfiguration { - return pigeonInstance.configuration - } - - func setUIDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws { - pigeonInstance.uIDelegate = delegate: delegate - } - - func setNavigationDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws { - pigeonInstance.navigationDelegate = delegate: delegate - } - - func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.url - } - - func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Double { - return pigeonInstance.estimatedProgress - } - - func load(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws { - pigeonInstance.load(request: request) - } - - func loadHtmlString(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws { - pigeonInstance.loadHtmlString(string: string, baseUrl: baseUrl) - } - - func loadFileUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws { - pigeonInstance.loadFileUrl(url: url, readAccessUrl: readAccessUrl) - } - - func loadFlutterAsset(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws { - pigeonInstance.loadFlutterAsset(key: key) - } - - func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { - return pigeonInstance.canGoBack() - } - - func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { - return pigeonInstance.canGoForward() - } - - func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.goBack() - } - - func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.goForward() - } - - func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.reload() - } - - func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.title - } - - func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { - pigeonInstance.allowsBackForwardNavigationGestures = allow: allow - } - - func setCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws { - pigeonInstance.customUserAgent = userAgent: userAgent - } - - func evaluateJavaScript(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) { - return pigeonInstance.evaluateJavaScript(javaScriptString: javaScriptString) - } - - func setInspectable(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws { - pigeonInstance.inspectable = inspectable: inspectable - } - - func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.customUserAgent - } - - func setAllowsLinkPreview(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { - pigeonInstance.allowsLinkPreview = allow: allow - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebViewProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: TestWebViewConfiguration) - XCTAssertNotNil(instance) - } - - func testConfiguration() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = try? api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.configuration) - } - - func testSetUIDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let delegate = TestUIDelegate - api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setUIDelegateArgs, [delegate]) - } - - func testSetNavigationDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let delegate = TestNavigationDelegate - api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setNavigationDelegateArgs, [delegate]) - } - - func testGetUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getUrlCalled) - XCTAssertEqual(value, instance.getUrl()) - } - - func testGetEstimatedProgress() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getEstimatedProgressCalled) - XCTAssertEqual(value, instance.getEstimatedProgress()) - } - - func testLoad() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let request = TestURLRequestWrapper - api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: instance, request: request) - - XCTAssertEqual(instance.loadArgs, [request]) - } - - func testLoadHtmlString() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let string = "myString" - let baseUrl = "myString" - api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: instance, string: string, baseUrl: baseUrl) - - XCTAssertEqual(instance.loadHtmlStringArgs, [string, baseUrl]) - } - - func testLoadFileUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let url = "myString" - let readAccessUrl = "myString" - api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: instance, url: url, readAccessUrl: readAccessUrl) - - XCTAssertEqual(instance.loadFileUrlArgs, [url, readAccessUrl]) - } - - func testLoadFlutterAsset() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let key = "myString" - api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: instance, key: key) - - XCTAssertEqual(instance.loadFlutterAssetArgs, [key]) - } - - func testCanGoBack() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.canGoBackCalled) - XCTAssertEqual(value, instance.canGoBack()) - } - - func testCanGoForward() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.canGoForwardCalled) - XCTAssertEqual(value, instance.canGoForward()) - } - - func testGoBack() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.goBackCalled) - } - - func testGoForward() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.goForwardCalled) - } - - func testReload() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.reloadCalled) - } - - func testGetTitle() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getTitleCalled) - XCTAssertEqual(value, instance.getTitle()) - } - - func testSetAllowsBackForwardNavigationGestures() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let allow = true - api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsBackForwardNavigationGesturesArgs, [allow]) - } - - func testSetCustomUserAgent() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let userAgent = "myString" - api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: instance, userAgent: userAgent) - - XCTAssertEqual(instance.setCustomUserAgentArgs, [userAgent]) - } - - func testEvaluateJavaScript() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let javaScriptString = "myString" - let value = api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: instance, javaScriptString: javaScriptString) - - XCTAssertEqual(instance.evaluateJavaScriptArgs, [javaScriptString]) - XCTAssertEqual(value, instance.evaluateJavaScript(javaScriptString: javaScriptString)) - } - - func testSetInspectable() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let inspectable = true - api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: instance, inspectable: inspectable) - - XCTAssertEqual(instance.setInspectableArgs, [inspectable]) - } - - func testGetCustomUserAgent() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getCustomUserAgentCalled) - XCTAssertEqual(value, instance.getCustomUserAgent()) - } - - func testSetAllowsLinkPreview() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let allow = true - api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsLinkPreviewArgs, [allow]) - } - -} -class TestWebView: NSViewWKWebView { - private var configurationTestValue = TestWebViewConfiguration - var setUIDelegateArgs: [AnyHashable?]? = nil - var setNavigationDelegateArgs: [AnyHashable?]? = nil - var getUrlCalled = false - var getEstimatedProgressCalled = false - var loadArgs: [AnyHashable?]? = nil - var loadHtmlStringArgs: [AnyHashable?]? = nil - var loadFileUrlArgs: [AnyHashable?]? = nil - var loadFlutterAssetArgs: [AnyHashable?]? = nil - var canGoBackCalled = false - var canGoForwardCalled = false - var goBackCalled = false - var goForwardCalled = false - var reloadCalled = false - var getTitleCalled = false - var setAllowsBackForwardNavigationGesturesArgs: [AnyHashable?]? = nil - var setCustomUserAgentArgs: [AnyHashable?]? = nil - var evaluateJavaScriptArgs: [AnyHashable?]? = nil - var setInspectableArgs: [AnyHashable?]? = nil - var getCustomUserAgentCalled = false - var setAllowsLinkPreviewArgs: [AnyHashable?]? = nil - - override var configuration: WKWebViewConfiguration { - return configurationTestValue + do { + let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) + } + #endif + #if !os(iOS) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } + #endif } - override func setUIDelegate() { - setUIDelegateArgs = [delegate] - } - override func setNavigationDelegate() { - setNavigationDelegateArgs = [delegate] - } - override func getUrl() { - getUrlCalled = true - } - override func getEstimatedProgress() { - getEstimatedProgressCalled = true - } - override func load() { - loadArgs = [request] - } - override func loadHtmlString() { - loadHtmlStringArgs = [string, baseUrl] - } - override func loadFileUrl() { - loadFileUrlArgs = [url, readAccessUrl] - } - override func loadFlutterAsset() { - loadFlutterAssetArgs = [key] - } - override func canGoBack() { - canGoBackCalled = true - } - override func canGoForward() { - canGoForwardCalled = true - } - override func goBack() { - goBackCalled = true - } - override func goForward() { - goForwardCalled = true - } - override func reload() { - reloadCalled = true - } - override func getTitle() { - getTitleCalled = true - } - override func setAllowsBackForwardNavigationGestures() { - setAllowsBackForwardNavigationGesturesArgs = [allow] - } - override func setCustomUserAgent() { - setCustomUserAgentArgs = [userAgent] - } - override func evaluateJavaScript() { - evaluateJavaScriptArgs = [javaScriptString] - return -1 - } - override func setInspectable() { - setInspectableArgs = [inspectable] - } - override func getCustomUserAgent() { - getCustomUserAgentCalled = true - } - override func setAllowsLinkPreview() { - setAllowsLinkPreviewArgs = [allow] + #if !os(iOS) + ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + } + } + } } + #endif } -*/ - open class PigeonApiDelegateWKWebView { } @@ -8416,159 +5417,6 @@ withIdentifier: pigeonIdentifierArg) } } - -/* -// 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 Foundation -import WebKit - -/// Implementation of `WKUIDelegate` that calls to Dart in callback methods. -class UIDelegateImpl: WKUIDelegate { - let api: PigeonApiProtocolWKUIDelegate - - init(api: PigeonApiProtocolWKUIDelegate) { - self.api = api - } - - func fixMe() { - api.onCreateWebView(pigeonInstance: self, webView: webView, configuration: configuration, navigationAction: navigationAction) { _ in } - } - - func fixMe() { - api.requestMediaCapturePermission(pigeonInstance: self, webView: webView, origin: origin, frame: frame, type: type) { _ in } - } - - func fixMe() { - api.runJavaScriptAlertPanel(pigeonInstance: self, webView: webView, message: message, frame: frame) { _ in } - } - - func fixMe() { - api.runJavaScriptConfirmPanel(pigeonInstance: self, webView: webView, message: message, frame: frame) { _ in } - } - - func fixMe() { - api.runJavaScriptTextInputPanel(pigeonInstance: self, webView: webView, prompt: prompt, defaultText: defaultText, frame: frame) { _ in } - } -} - -/// ProxyApi implementation for `WKUIDelegate`. -/// -/// 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 UIDelegateProxyAPIDelegate : PigeonApiDelegateWKUIDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUIDelegate) throws -> WKUIDelegate { - return WKUIDelegateImpl(api: pigeonApi) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class UIDelegateProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUIDelegate(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testOnCreateWebView() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let configuration = TestWebViewConfiguration - let navigationAction = TestNavigationAction - instance.onCreateWebView(webView: webView, configuration: configuration, navigationAction: navigationAction) - - XCTAssertEqual(api.onCreateWebViewArgs, [webView, configuration, navigationAction]) - } - - func testRequestMediaCapturePermission() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let origin = TestSecurityOrigin - let frame = TestFrameInfo - let type = .camera - instance.requestMediaCapturePermission(webView: webView, origin: origin, frame: frame, type: type) - - XCTAssertEqual(api.requestMediaCapturePermissionArgs, [webView, origin, frame, type]) - } - - func testRunJavaScriptAlertPanel() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let message = "myString" - let frame = TestFrameInfo - instance.runJavaScriptAlertPanel(webView: webView, message: message, frame: frame) - - XCTAssertEqual(api.runJavaScriptAlertPanelArgs, [webView, message, frame]) - } - - func testRunJavaScriptConfirmPanel() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let message = "myString" - let frame = TestFrameInfo - instance.runJavaScriptConfirmPanel(webView: webView, message: message, frame: frame) - - XCTAssertEqual(api.runJavaScriptConfirmPanelArgs, [webView, message, frame]) - } - - func testRunJavaScriptTextInputPanel() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let prompt = "myString" - let defaultText = "myString" - let frame = TestFrameInfo - instance.runJavaScriptTextInputPanel(webView: webView, prompt: prompt, defaultText: defaultText, frame: frame) - - XCTAssertEqual(api.runJavaScriptTextInputPanelArgs, [webView, prompt, defaultText, frame]) - } - -} -class TestUIDelegateApi: PigeonApiProtocolWKUIDelegate { - var onCreateWebViewArgs: [AnyHashable?]? = nil - var requestMediaCapturePermissionArgs: [AnyHashable?]? = nil - var runJavaScriptAlertPanelArgs: [AnyHashable?]? = nil - var runJavaScriptConfirmPanelArgs: [AnyHashable?]? = nil - var runJavaScriptTextInputPanelArgs: [AnyHashable?]? = nil - - func onCreateWebView(webView: WKWebView, configuration: WKWebViewConfiguration, navigationAction: WKNavigationAction) throws { - onCreateWebViewArgs = [webViewArg, configurationArg, navigationActionArg] - } - func requestMediaCapturePermission(webView: WKWebView, origin: WKSecurityOrigin, frame: WKFrameInfo, type: MediaCaptureType) throws -> PermissionDecision { - requestMediaCapturePermissionArgs = [webViewArg, originArg, frameArg, typeArg] - } - func runJavaScriptAlertPanel(webView: WKWebView, message: String, frame: WKFrameInfo) throws { - runJavaScriptAlertPanelArgs = [webViewArg, messageArg, frameArg] - } - func runJavaScriptConfirmPanel(webView: WKWebView, message: String, frame: WKFrameInfo) throws -> Bool { - runJavaScriptConfirmPanelArgs = [webViewArg, messageArg, frameArg] - } - func runJavaScriptTextInputPanel(webView: WKWebView, prompt: String, defaultText: String?, frame: WKFrameInfo) throws -> String? { - runJavaScriptTextInputPanelArgs = [webViewArg, promptArg, defaultTextArg, frameArg] - } -} -*/ - protocol PigeonApiDelegateWKHTTPCookieStore { /// Sets a cookie policy that indicates whether the cookie store allows cookie /// storage. @@ -8649,62 +5497,6 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKHTTPCookieStore`. -/// -/// 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 HTTPCookieStoreProxyAPIDelegate : PigeonApiDelegateWKHTTPCookieStore { - func setCookie(pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, completion: @escaping (Result) -> Void) { - pigeonInstance.cookie = cookie: cookie - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class HTTPCookieStoreProxyAPITests: XCTestCase { - func testSetCookie() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKHTTPCookieStore(registrar) - - let instance = TestHTTPCookieStore() - let cookie = TestHTTPCookie - api.pigeonDelegate.setCookie(pigeonApi: api, pigeonInstance: instance, cookie: cookie) - - XCTAssertEqual(instance.setCookieArgs, [cookie]) - } - -} -class TestHTTPCookieStore: WKHTTPCookieStore { - var setCookieArgs: [AnyHashable?]? = nil - - - override func setCookie() { - setCookieArgs = [cookie] - } -} -*/ - protocol PigeonApiDelegateUIScrollViewDelegate { #if !os(macOS) func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate @@ -8832,81 +5624,6 @@ withIdentifier: pigeonIdentifierArg) #endif } - -/* -// 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 Foundation -import UIKit - -/// Implementation of `UIScrollViewDelegate` that calls to Dart in callback methods. -class ScrollViewDelegateImpl: UIScrollViewDelegate { - let api: PigeonApiProtocolUIScrollViewDelegate - - init(api: PigeonApiProtocolUIScrollViewDelegate) { - self.api = api - } - - func fixMe() { - api.scrollViewDidScroll(pigeonInstance: self, scrollView: scrollView, x: x, y: y) { _ in } - } -} - -/// ProxyApi implementation for `UIScrollViewDelegate`. -/// -/// 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 ScrollViewDelegateProxyAPIDelegate : PigeonApiDelegateUIScrollViewDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate { - return UIScrollViewDelegateImpl(api: pigeonApi) - } - -} -*/ - -/* -// 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 UIKit -import Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ScrollViewDelegateProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollViewDelegate(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testScrollViewDidScroll() { - let api = TestScrollViewDelegateApi() - let instance = ScrollViewDelegateImpl(api: api) - let scrollView = TestScrollView - let x = 1.0 - let y = 1.0 - instance.scrollViewDidScroll(scrollView: scrollView, x: x, y: y) - - XCTAssertEqual(api.scrollViewDidScrollArgs, [scrollView, x, y]) - } - -} -class TestScrollViewDelegateApi: PigeonApiProtocolUIScrollViewDelegate { - var scrollViewDidScrollArgs: [AnyHashable?]? = nil - - func scrollViewDidScroll(scrollView: UIScrollView, x: Double, y: Double) throws { - scrollViewDidScrollArgs = [scrollViewArg, xArg, yArg] - } -} -*/ - protocol PigeonApiDelegateURLCredential { /// Creates a URL credential instance for internet password authentication /// with a given user name and password, using a given persistence setting. @@ -8966,74 +5683,29 @@ withIdentifier: pigeonIdentifierArg) 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.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(())) - } - } - } - } -} - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URLCredential`. -/// -/// 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 URLCredentialProxyAPIDelegate : PigeonApiDelegateURLCredential { - func withUser(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence) throws -> URLCredential { - return URLCredential(,user: user, password: password, persistence: persistence) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLCredentialProxyAPITests: XCTestCase { - func testWithUser() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLCredential(registrar) - - let instance = try? api.pigeonDelegate.withUser(pigeonApi: api, user: "myString", password: "myString", persistence: .none) - XCTAssertNotNil(instance) + } 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(())) + } + } + } } - } -*/ - protocol PigeonApiDelegateURLProtectionSpace { /// The receiver’s host. func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String @@ -9122,134 +5794,6 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URLProtectionSpace`. -/// -/// 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 URLProtectionSpaceProxyAPIDelegate : PigeonApiDelegateURLProtectionSpace { - func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String { - return pigeonInstance.host - } - - func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> Int64 { - return pigeonInstance.port - } - - func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? { - return pigeonInstance.realm - } - - func authenticationMethod(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? { - return pigeonInstance.authenticationMethod - } - - func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> SecTrustWrapper? { - return pigeonInstance.serverTrust - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLProtectionSpaceProxyAPITests: XCTestCase { - func testHost() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = try? api.pigeonDelegate.host(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.host) - } - - func testPort() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = try? api.pigeonDelegate.port(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.port) - } - - func testRealm() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = try? api.pigeonDelegate.realm(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.realm) - } - - func testAuthenticationMethod() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = try? api.pigeonDelegate.authenticationMethod(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.authenticationMethod) - } - - func testGetServerTrust() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = api.pigeonDelegate.getServerTrust(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getServerTrustCalled) - XCTAssertEqual(value, instance.getServerTrust()) - } - -} -class TestURLProtectionSpace: URLProtectionSpace { - private var hostTestValue = "myString" - private var portTestValue = 0 - private var realmTestValue = "myString" - private var authenticationMethodTestValue = "myString" - var getServerTrustCalled = false - - override var host: String { - return hostTestValue - } - override var port: Int64 { - return portTestValue - } - override var realm: String { - return realmTestValue - } - override var authenticationMethod: String { - return authenticationMethodTestValue - } - - override func getServerTrust() { - getServerTrustCalled = true - } -} -*/ - protocol PigeonApiDelegateURLAuthenticationChallenge { /// The receiver’s protection space. func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace @@ -9326,62 +5870,6 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URLAuthenticationChallenge`. -/// -/// 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 URLAuthenticationChallengeProxyAPIDelegate : PigeonApiDelegateURLAuthenticationChallenge { - func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace { - return pigeonInstance.protectionSpace - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLAuthenticationChallengeProxyAPITests: XCTestCase { - func testGetProtectionSpace() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLAuthenticationChallenge(registrar) - - let instance = TestURLAuthenticationChallenge() - let value = api.pigeonDelegate.getProtectionSpace(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getProtectionSpaceCalled) - XCTAssertEqual(value, instance.getProtectionSpace()) - } - -} -class TestURLAuthenticationChallenge: URLAuthenticationChallenge { - var getProtectionSpaceCalled = false - - - override func getProtectionSpace() { - getProtectionSpaceCalled = true - } -} -*/ - protocol PigeonApiDelegateURL { /// The absolute string for the URL. func getAbsoluteString(pigeonApi: PigeonApiURL, pigeonInstance: URL) throws -> String @@ -9458,62 +5946,6 @@ final class PigeonApiURL: PigeonApiProtocolURL { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URL`. -/// -/// 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 URLProxyAPIDelegate : PigeonApiDelegateURL { - func getAbsoluteString(pigeonApi: PigeonApiURL, pigeonInstance: URL) throws -> String { - return pigeonInstance.absoluteString - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLProxyAPITests: XCTestCase { - func testGetAbsoluteString() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURL(registrar) - - let instance = TestURL() - let value = api.pigeonDelegate.getAbsoluteString(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getAbsoluteStringCalled) - XCTAssertEqual(value, instance.getAbsoluteString()) - } - -} -class TestURL: URL { - var getAbsoluteStringCalled = false - - - override func getAbsoluteString() { - getAbsoluteStringCalled = true - } -} -*/ - protocol PigeonApiDelegateWKWebpagePreferences { /// A Boolean value that indicates whether JavaScript from web content is /// allowed to run. @@ -9610,62 +6042,6 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } } } - -/* -// 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 Foundation -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 { - func setAllowsContentJavaScript(pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) throws { - pigeonInstance.allowsContentJavaScript = allow: allow - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebpagePreferencesProxyAPITests: XCTestCase { - func testSetAllowsContentJavaScript() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebpagePreferences(registrar) - - let instance = TestWebpagePreferences() - let allow = true - api.pigeonDelegate.setAllowsContentJavaScript(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsContentJavaScriptArgs, [allow]) - } - -} -class TestWebpagePreferences: WKWebpagePreferences { - var setAllowsContentJavaScriptArgs: [AnyHashable?]? = nil - - - override func setAllowsContentJavaScript() { - setAllowsContentJavaScriptArgs = [allow] - } -} -*/ - protocol PigeonApiDelegateGetTrustResultResponse { /// The result code from the most recent trust evaluation. func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType @@ -9725,86 +6101,6 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `GetTrustResultResponse`. -/// -/// 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 GetTrustResultResponseProxyAPIDelegate : PigeonApiDelegateGetTrustResultResponse { - func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType { - switch pigeonInstance.result { - case .unspecified: - return .unspecified - case .proceed: - return .proceed - case .deny: - return .deny - case .recoverableTrustFailure: - return .recoverableTrustFailure - case .fatalTrustFailure: - return .fatalTrustFailure - case .otherError: - return .otherError - case .invalid: - return .invalid - case .confirm: - return .confirm - @unknown default: - return .unknown - } - } - - func resultCode(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> Int64 { - return pigeonInstance.resultCode - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class GetTrustResultResponseProxyAPITests: XCTestCase { - func testResult() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiGetTrustResultResponse(registrar) - - let instance = TestGetTrustResultResponse() - let value = try? api.pigeonDelegate.result(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.result) - } - - func testResultCode() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiGetTrustResultResponse(registrar) - - let instance = TestGetTrustResultResponse() - let value = try? api.pigeonDelegate.resultCode(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.resultCode) - } - -} -*/ - protocol PigeonApiDelegateSecTrust { /// Evaluates trust for the specified certificate and policies. func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) @@ -9954,59 +6250,6 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `SecTrust`. -/// -/// 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 SecTrustWrapperProxyAPIDelegate : PigeonApiDelegateSecTrust { - func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) { - return SecTrust.evaluateWithError(trust: trust) - } - - func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> FlutterStandardTypedData? { - return SecTrust.copyExceptions(trust: trust) - } - - func setExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData?) throws -> Bool { - return SecTrust.setExceptions(trust: trust, exceptions: exceptions) - } - - func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> GetTrustResultResponse { - return SecTrust.getTrustResult(trust: trust) - } - - func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> [SecCertificateWrapper]? { - return SecTrust.copyCertificateChain(trust: trust) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class SecTrustWrapperProxyAPITests: XCTestCase { -} -*/ - protocol PigeonApiDelegateSecCertificate { /// Returns a DER representation of a certificate given a certificate object. func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData @@ -10083,40 +6326,3 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `SecCertificate`. -/// -/// 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 SecCertificateWrapperProxyAPIDelegate : PigeonApiDelegateSecCertificate { - func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData { - return SecCertificate.copyData(certificate: certificate) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class SecCertificateWrapperProxyAPITests: XCTestCase { -} -*/ - 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 8978c9f471c5..45871baa33e4 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 @@ -421,270 +421,6 @@ class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { } } -/// Handles constructing objects and calling static methods for the Android -/// Interactive Media Ads native library. -/// -/// This class provides dependency injection for the implementations of the -/// platform interface classes. Improving the ease of unit testing and/or -/// overriding the underlying Android classes. -/// -/// By default each function calls the default constructor of the class it -/// intends to return. -class WebKitGProxy { - /// Constructs an [WebKitGProxy]. - const WebKitGProxy({ - this.newURLRequest = URLRequest.new, - this.newWKUserScript = WKUserScript.new, - this.newHTTPCookie = HTTPCookie.new, - this.newAuthenticationChallengeResponse = - AuthenticationChallengeResponse.new, - this.newWKWebViewConfiguration = WKWebViewConfiguration.new, - this.newWKScriptMessageHandler = WKScriptMessageHandler.new, - this.newWKNavigationDelegate = WKNavigationDelegate.new, - this.newNSObject = NSObject.new, - this.newUIViewWKWebView = UIViewWKWebView.new, - this.newNSViewWKWebView = NSViewWKWebView.new, - this.newWKUIDelegate = WKUIDelegate.new, - this.newUIScrollViewDelegate = UIScrollViewDelegate.new, - this.withUserURLCredential = URLCredential.withUser, - this.evaluateWithErrorSecTrust = SecTrust.evaluateWithError, - this.copyExceptionsSecTrust = SecTrust.copyExceptions, - this.setExceptionsSecTrust = SecTrust.setExceptions, - this.getTrustResultSecTrust = SecTrust.getTrustResult, - this.copyCertificateChainSecTrust = SecTrust.copyCertificateChain, - this.copyDataSecCertificate = SecCertificate.copyData, - this.defaultDataStoreWKWebsiteDataStore = - _defaultDataStoreWKWebsiteDataStore, - }); - - /// Constructs [URLRequest]. - final URLRequest Function({ - required String url, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newURLRequest; - - /// Constructs [WKUserScript]. - final WKUserScript Function({ - required String source, - required UserScriptInjectionTime injectionTime, - required bool isForMainFrameOnly, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKUserScript; - - /// Constructs [HTTPCookie]. - final HTTPCookie Function({ - required Map properties, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newHTTPCookie; - - /// Constructs [AuthenticationChallengeResponse]. - final AuthenticationChallengeResponse Function({ - required UrlSessionAuthChallengeDisposition disposition, - URLCredential? credential, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newAuthenticationChallengeResponse; - - /// Constructs [WKWebViewConfiguration]. - final WKWebViewConfiguration Function({ - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKWebViewConfiguration; - - /// Constructs [WKScriptMessageHandler]. - final WKScriptMessageHandler Function({ - required void Function( - WKScriptMessageHandler, - WKUserContentController, - WKScriptMessage, - ) didReceiveScriptMessage, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKScriptMessageHandler; - - /// Constructs [WKNavigationDelegate]. - final WKNavigationDelegate Function({ - required Future Function( - WKNavigationDelegate, - WKWebView, - WKNavigationAction, - ) decidePolicyForNavigationAction, - required Future Function( - WKNavigationDelegate, - WKWebView, - WKNavigationResponse, - ) decidePolicyForNavigationResponse, - required Future> Function( - WKNavigationDelegate, - WKWebView, - URLAuthenticationChallenge, - ) didReceiveAuthenticationChallenge, - void Function( - WKNavigationDelegate, - WKWebView, - String?, - )? didFinishNavigation, - void Function( - WKNavigationDelegate, - WKWebView, - String?, - )? didStartProvisionalNavigation, - void Function( - WKNavigationDelegate, - WKWebView, - NSError, - )? didFailNavigation, - void Function( - WKNavigationDelegate, - WKWebView, - NSError, - )? didFailProvisionalNavigation, - void Function( - WKNavigationDelegate, - WKWebView, - )? webViewWebContentProcessDidTerminate, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKNavigationDelegate; - - /// Constructs [NSObject]. - final NSObject Function({ - void Function( - NSObject, - String?, - NSObject?, - Map?, - )? observeValue, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newNSObject; - - /// Constructs [UIViewWKWebView]. - final UIViewWKWebView Function({ - required WKWebViewConfiguration initialConfiguration, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newUIViewWKWebView; - - /// Constructs [NSViewWKWebView]. - final NSViewWKWebView Function({ - required WKWebViewConfiguration initialConfiguration, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newNSViewWKWebView; - - /// Constructs [WKUIDelegate]. - final WKUIDelegate Function({ - required Future Function( - WKUIDelegate, - WKWebView, - WKSecurityOrigin, - WKFrameInfo, - MediaCaptureType, - ) requestMediaCapturePermission, - required Future Function( - WKUIDelegate, - WKWebView, - String, - WKFrameInfo, - ) runJavaScriptConfirmPanel, - void Function( - WKUIDelegate, - WKWebView, - WKWebViewConfiguration, - WKNavigationAction, - )? onCreateWebView, - Future Function( - WKUIDelegate, - WKWebView, - String, - WKFrameInfo, - )? runJavaScriptAlertPanel, - Future Function( - WKUIDelegate, - WKWebView, - String, - String?, - WKFrameInfo, - )? runJavaScriptTextInputPanel, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKUIDelegate; - - /// Constructs [UIScrollViewDelegate]. - final UIScrollViewDelegate Function({ - void Function( - UIScrollViewDelegate, - UIScrollView, - double, - double, - )? scrollViewDidScroll, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newUIScrollViewDelegate; - - /// Constructs [URLCredential]. - final URLCredential Function({ - required String user, - required String password, - required UrlCredentialPersistence persistence, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) withUserURLCredential; - - /// Calls to [SecTrust.evaluateWithError]. - final Future Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) evaluateWithErrorSecTrust; - - /// Calls to [SecTrust.copyExceptions]. - final Future Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) copyExceptionsSecTrust; - - /// Calls to [SecTrust.setExceptions]. - final Future Function( - SecTrust, - Uint8List?, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) setExceptionsSecTrust; - - /// Calls to [SecTrust.getTrustResult]. - final Future Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) getTrustResultSecTrust; - - /// Calls to [SecTrust.copyCertificateChain]. - final Future?> Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) copyCertificateChainSecTrust; - - /// Calls to [SecCertificate.copyData]. - final Future Function( - SecCertificate, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) copyDataSecCertificate; - - /// Calls to [WKWebsiteDataStore.defaultDataStore]. - final WKWebsiteDataStore Function() defaultDataStoreWKWebsiteDataStore; - - static WKWebsiteDataStore _defaultDataStoreWKWebsiteDataStore() => - WKWebsiteDataStore.defaultDataStore; -} - /// The values that can be returned in a change dictionary. /// diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart index 4a07c7b10dbb..b694b03de6e3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart @@ -3,11 +3,15 @@ // found in the LICENSE file. import 'package:flutter/services.dart'; +import 'package:meta/meta.dart'; import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; import 'common/web_kit.g.dart'; import 'webkit_proxy.dart'; +/// An implementation of [PlatformSslAuthError] with the WebKit api. class WebKitSslAuthError extends PlatformSslAuthError { + /// Creates a [WebKitSslAuthError]. + @internal WebKitSslAuthError({ required super.certificate, required super.description, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index f69ef53c0850..9cfd5751c6cc 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -24,6 +24,7 @@ flutter: dependencies: flutter: sdk: flutter + meta: ^1.10.0 path: ^1.8.0 webview_flutter_platform_interface: ^2.11.0 @@ -32,11 +33,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: - git: - url: git@github.com:bparrishMines/packages.git - ref: pigeon_helper - path: packages/pigeon + pigeon: ^25.3.1 topics: - html From 2c6eb0118cd5f9011e8f207f1b941782d280561b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 22:34:09 -0400 Subject: [PATCH 23/34] formatting --- .../WebKitLibrary.g.swift | 4883 ++++++++++------- .../lib/src/common/web_kit.g.dart | 322 +- .../web_kit_cookie_manager_test.mocks.dart | 163 +- .../web_kit_webview_widget_test.mocks.dart | 1801 +++--- ...webkit_navigation_delegate_test.mocks.dart | 327 +- .../webkit_webview_controller_test.mocks.dart | 1946 +++---- ...kit_webview_cookie_manager_test.mocks.dart | 163 +- .../webkit_webview_widget_test.mocks.dart | 361 +- 8 files changed, 5345 insertions(+), 4621 deletions(-) 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 9cb7aaae02e4..dbb88c1696ae 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 @@ -6,8 +6,9 @@ import Foundation import WebKit + #if !os(macOS) -import UIKit + import UIKit #endif #if os(iOS) @@ -63,7 +64,9 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return PigeonError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -81,7 +84,6 @@ protocol WebKitLibraryPigeonInternalFinalizerDelegate: AnyObject { func onDeinit(identifier: Int64) } - // Attaches to an object to receive a callback when the object is deallocated. internal final class WebKitLibraryPigeonInternalFinalizer { private static let associatedObjectKey = malloc(1)! @@ -97,7 +99,8 @@ internal final class WebKitLibraryPigeonInternalFinalizer { } internal static func attach( - to instance: AnyObject, identifier: Int64, delegate: WebKitLibraryPigeonInternalFinalizerDelegate + to instance: AnyObject, identifier: Int64, + delegate: WebKitLibraryPigeonInternalFinalizerDelegate ) { let finalizer = WebKitLibraryPigeonInternalFinalizer(identifier: identifier, delegate: delegate) objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) @@ -112,7 +115,6 @@ internal final class WebKitLibraryPigeonInternalFinalizer { } } - /// Maintains instances used to communicate with the corresponding objects in Dart. /// /// Objects stored in this container are represented by an object in Dart that is also stored in @@ -216,7 +218,8 @@ final class WebKitLibraryPigeonInstanceManager { identifiers.setObject(NSNumber(value: identifier), forKey: instance) weakInstances.setObject(instance, forKey: NSNumber(value: identifier)) strongInstances.setObject(instance, forKey: NSNumber(value: identifier)) - WebKitLibraryPigeonInternalFinalizer.attach(to: instance, identifier: identifier, delegate: finalizerDelegate) + WebKitLibraryPigeonInternalFinalizer.attach( + to: instance, identifier: identifier, delegate: finalizerDelegate) } /// Retrieves the identifier paired with an instance. @@ -293,7 +296,6 @@ final class WebKitLibraryPigeonInstanceManager { } } - private class WebKitLibraryPigeonInstanceManagerApi { /// The codec used for serializing messages. var codec: FlutterStandardMessageCodec { WebKitLibraryPigeonCodec.shared } @@ -306,9 +308,14 @@ private class WebKitLibraryPigeonInstanceManagerApi { } /// Sets up an instance of `WebKitLibraryPigeonInstanceManagerApi` to handle messages through the `binaryMessenger`. - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, instanceManager: WebKitLibraryPigeonInstanceManager?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, instanceManager: WebKitLibraryPigeonInstanceManager? + ) { let codec = WebKitLibraryPigeonCodec.shared - let removeStrongReferenceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference", binaryMessenger: binaryMessenger, codec: codec) + let removeStrongReferenceChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference", + binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { removeStrongReferenceChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -323,7 +330,9 @@ private class WebKitLibraryPigeonInstanceManagerApi { } else { removeStrongReferenceChannel.setMessageHandler(nil) } - let clearChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.clear", binaryMessenger: binaryMessenger, codec: codec) + let clearChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.clear", + binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { clearChannel.setMessageHandler { _, reply in do { @@ -339,9 +348,13 @@ private class WebKitLibraryPigeonInstanceManagerApi { } /// Sends a message to the Dart `InstanceManager` to remove the strong reference of the instance associated with `identifier`. - func removeStrongReference(identifier identifierArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func removeStrongReference( + identifier identifierArg: Int64, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([identifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -364,111 +377,141 @@ protocol WebKitLibraryPigeonProxyApiDelegate { func pigeonApiURLRequest(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLRequest /// An implementation of [PigeonApiHTTPURLResponse] used to add a new Dart instance of /// `HTTPURLResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiHTTPURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiHTTPURLResponse + func pigeonApiHTTPURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiHTTPURLResponse /// An implementation of [PigeonApiURLResponse] used to add a new Dart instance of /// `URLResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLResponse + func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLResponse /// An implementation of [PigeonApiWKUserScript] used to add a new Dart instance of /// `WKUserScript` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUserScript(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUserScript + func pigeonApiWKUserScript(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKUserScript /// An implementation of [PigeonApiWKNavigationAction] used to add a new Dart instance of /// `WKNavigationAction` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationAction(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationAction + func pigeonApiWKNavigationAction(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKNavigationAction /// An implementation of [PigeonApiWKNavigationResponse] used to add a new Dart instance of /// `WKNavigationResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationResponse + func pigeonApiWKNavigationResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKNavigationResponse /// An implementation of [PigeonApiWKFrameInfo] used to add a new Dart instance of /// `WKFrameInfo` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKFrameInfo(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKFrameInfo + func pigeonApiWKFrameInfo(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKFrameInfo /// An implementation of [PigeonApiNSError] used to add a new Dart instance of /// `NSError` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiNSError(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSError /// An implementation of [PigeonApiWKScriptMessage] used to add a new Dart instance of /// `WKScriptMessage` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKScriptMessage(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKScriptMessage + func pigeonApiWKScriptMessage(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKScriptMessage /// An implementation of [PigeonApiWKSecurityOrigin] used to add a new Dart instance of /// `WKSecurityOrigin` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKSecurityOrigin(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKSecurityOrigin + func pigeonApiWKSecurityOrigin(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKSecurityOrigin /// An implementation of [PigeonApiHTTPCookie] used to add a new Dart instance of /// `HTTPCookie` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiHTTPCookie(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiHTTPCookie /// An implementation of [PigeonApiAuthenticationChallengeResponse] used to add a new Dart instance of /// `AuthenticationChallengeResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiAuthenticationChallengeResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiAuthenticationChallengeResponse + func pigeonApiAuthenticationChallengeResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiAuthenticationChallengeResponse /// An implementation of [PigeonApiWKWebsiteDataStore] used to add a new Dart instance of /// `WKWebsiteDataStore` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKWebsiteDataStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebsiteDataStore + func pigeonApiWKWebsiteDataStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKWebsiteDataStore /// An implementation of [PigeonApiUIView] used to add a new Dart instance of /// `UIView` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiUIView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIView /// An implementation of [PigeonApiUIScrollView] used to add a new Dart instance of /// `UIScrollView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIScrollView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIScrollView + func pigeonApiUIScrollView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIScrollView /// An implementation of [PigeonApiWKWebViewConfiguration] used to add a new Dart instance of /// `WKWebViewConfiguration` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKWebViewConfiguration(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebViewConfiguration + func pigeonApiWKWebViewConfiguration(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKWebViewConfiguration /// An implementation of [PigeonApiWKUserContentController] used to add a new Dart instance of /// `WKUserContentController` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUserContentController(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUserContentController + func pigeonApiWKUserContentController(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKUserContentController /// An implementation of [PigeonApiWKPreferences] used to add a new Dart instance of /// `WKPreferences` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKPreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKPreferences + func pigeonApiWKPreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKPreferences /// An implementation of [PigeonApiWKScriptMessageHandler] used to add a new Dart instance of /// `WKScriptMessageHandler` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKScriptMessageHandler(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKScriptMessageHandler + func pigeonApiWKScriptMessageHandler(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKScriptMessageHandler /// An implementation of [PigeonApiWKNavigationDelegate] used to add a new Dart instance of /// `WKNavigationDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationDelegate + func pigeonApiWKNavigationDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKNavigationDelegate /// An implementation of [PigeonApiNSObject] used to add a new Dart instance of /// `NSObject` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiNSObject(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject /// An implementation of [PigeonApiUIViewWKWebView] used to add a new Dart instance of /// `UIViewWKWebView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIViewWKWebView + func pigeonApiUIViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIViewWKWebView /// An implementation of [PigeonApiNSViewWKWebView] used to add a new Dart instance of /// `NSViewWKWebView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiNSViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSViewWKWebView + func pigeonApiNSViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiNSViewWKWebView /// An implementation of [PigeonApiWKWebView] used to add a new Dart instance of /// `WKWebView` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebView /// An implementation of [PigeonApiWKUIDelegate] used to add a new Dart instance of /// `WKUIDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUIDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUIDelegate + func pigeonApiWKUIDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKUIDelegate /// An implementation of [PigeonApiWKHTTPCookieStore] used to add a new Dart instance of /// `WKHTTPCookieStore` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKHTTPCookieStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKHTTPCookieStore + func pigeonApiWKHTTPCookieStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKHTTPCookieStore /// An implementation of [PigeonApiUIScrollViewDelegate] used to add a new Dart instance of /// `UIScrollViewDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIScrollViewDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIScrollViewDelegate + func pigeonApiUIScrollViewDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIScrollViewDelegate /// An implementation of [PigeonApiURLCredential] used to add a new Dart instance of /// `URLCredential` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLCredential(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLCredential + func pigeonApiURLCredential(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLCredential /// An implementation of [PigeonApiURLProtectionSpace] used to add a new Dart instance of /// `URLProtectionSpace` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLProtectionSpace(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLProtectionSpace + func pigeonApiURLProtectionSpace(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLProtectionSpace /// An implementation of [PigeonApiURLAuthenticationChallenge] used to add a new Dart instance of /// `URLAuthenticationChallenge` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLAuthenticationChallenge(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLAuthenticationChallenge + func pigeonApiURLAuthenticationChallenge(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLAuthenticationChallenge /// 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 + func pigeonApiWKWebpagePreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKWebpagePreferences /// An implementation of [PigeonApiGetTrustResultResponse] used to add a new Dart instance of /// `GetTrustResultResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiGetTrustResultResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiGetTrustResultResponse + func pigeonApiGetTrustResultResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiGetTrustResultResponse /// An implementation of [PigeonApiSecTrust] used to add a new Dart instance of /// `SecTrust` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiSecTrust(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiSecTrust /// An implementation of [PigeonApiSecCertificate] used to add a new Dart instance of /// `SecCertificate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiSecCertificate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiSecCertificate + func pigeonApiSecCertificate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiSecCertificate } extension WebKitLibraryPigeonProxyApiDelegate { - func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLResponse { - return PigeonApiURLResponse(pigeonRegistrar: registrar, delegate: PigeonApiDelegateURLResponse()) + func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLResponse + { + return PigeonApiURLResponse( + pigeonRegistrar: registrar, delegate: PigeonApiDelegateURLResponse()) } func pigeonApiWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebView { return PigeonApiWKWebView(pigeonRegistrar: registrar, delegate: PigeonApiDelegateWKWebView()) @@ -513,44 +556,74 @@ open class WebKitLibraryPigeonProxyApiRegistrar { } func setUp() { - WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager) - PigeonApiURLRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLRequest(self)) - PigeonApiWKUserScript.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserScript(self)) - PigeonApiHTTPCookie.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiHTTPCookie(self)) - PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiAuthenticationChallengeResponse(self)) - PigeonApiWKWebsiteDataStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebsiteDataStore(self)) - PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(self)) - PigeonApiUIScrollView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollView(self)) - PigeonApiWKWebViewConfiguration.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebViewConfiguration(self)) - PigeonApiWKUserContentController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserContentController(self)) - PigeonApiWKPreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKPreferences(self)) - PigeonApiWKScriptMessageHandler.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKScriptMessageHandler(self)) - PigeonApiWKNavigationDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKNavigationDelegate(self)) - PigeonApiNSObject.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSObject(self)) - PigeonApiUIViewWKWebView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewWKWebView(self)) - PigeonApiNSViewWKWebView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSViewWKWebView(self)) - PigeonApiWKUIDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUIDelegate(self)) - PigeonApiWKHTTPCookieStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKHTTPCookieStore(self)) - PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) - PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) - PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) - PigeonApiURLAuthenticationChallenge.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) - PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) - PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) - PigeonApiSecTrust.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecTrust(self)) - PigeonApiSecCertificate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecCertificate(self)) + WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger: binaryMessenger, instanceManager: instanceManager) + PigeonApiURLRequest.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLRequest(self)) + PigeonApiWKUserScript.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserScript(self)) + PigeonApiHTTPCookie.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiHTTPCookie(self)) + PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers( + binaryMessenger: binaryMessenger, + api: apiDelegate.pigeonApiAuthenticationChallengeResponse(self)) + PigeonApiWKWebsiteDataStore.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebsiteDataStore(self)) + PigeonApiUIView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(self)) + PigeonApiUIScrollView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollView(self)) + PigeonApiWKWebViewConfiguration.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebViewConfiguration(self)) + PigeonApiWKUserContentController.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserContentController(self)) + PigeonApiWKPreferences.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKPreferences(self)) + PigeonApiWKScriptMessageHandler.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKScriptMessageHandler(self)) + PigeonApiWKNavigationDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKNavigationDelegate(self)) + PigeonApiNSObject.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSObject(self)) + PigeonApiUIViewWKWebView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewWKWebView(self)) + PigeonApiNSViewWKWebView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSViewWKWebView(self)) + PigeonApiWKUIDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUIDelegate(self)) + PigeonApiWKHTTPCookieStore.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKHTTPCookieStore(self)) + PigeonApiUIScrollViewDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) + PigeonApiURLCredential.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) + PigeonApiURLProtectionSpace.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) + PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) + PigeonApiURL.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) + PigeonApiWKWebpagePreferences.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) + PigeonApiSecTrust.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecTrust(self)) + PigeonApiSecCertificate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecCertificate(self)) } func tearDown() { - WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil) + WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger: binaryMessenger, instanceManager: nil) PigeonApiURLRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKUserScript.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiHTTPCookie.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebsiteDataStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIScrollView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebViewConfiguration.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiWKUserContentController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiWKUserContentController.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: nil) PigeonApiWKPreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKScriptMessageHandler.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKNavigationDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -562,7 +635,8 @@ open class WebKitLibraryPigeonProxyApiRegistrar { PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiURLAuthenticationChallenge.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: nil) PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiSecTrust.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -605,252 +679,272 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand } override func writeValue(_ value: Any) { - if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String || value is KeyValueObservingOptions || value is KeyValueChange || value is KeyValueChangeKey || value is UserScriptInjectionTime || value is AudiovisualMediaType || value is WebsiteDataType || value is NavigationActionPolicy || value is NavigationResponsePolicy || value is HttpCookiePropertyKey || value is NavigationType || value is PermissionDecision || value is MediaCaptureType || value is UrlSessionAuthChallengeDisposition || value is UrlCredentialPersistence || value is DartSecTrustResultType { + if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] + || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String + || value is KeyValueObservingOptions || value is KeyValueChange + || value is KeyValueChangeKey || value is UserScriptInjectionTime + || value is AudiovisualMediaType || value is WebsiteDataType + || value is NavigationActionPolicy || value is NavigationResponsePolicy + || value is HttpCookiePropertyKey || value is NavigationType || value is PermissionDecision + || value is MediaCaptureType || value is UrlSessionAuthChallengeDisposition + || value is UrlCredentialPersistence || value is DartSecTrustResultType + { super.writeValue(value) return } - if let instance = value as? URLRequestWrapper { pigeonRegistrar.apiDelegate.pigeonApiURLRequest(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? HTTPURLResponse { pigeonRegistrar.apiDelegate.pigeonApiHTTPURLResponse(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? URLResponse { pigeonRegistrar.apiDelegate.pigeonApiURLResponse(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKUserScript { pigeonRegistrar.apiDelegate.pigeonApiWKUserScript(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKNavigationAction { pigeonRegistrar.apiDelegate.pigeonApiWKNavigationAction(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKNavigationResponse { - pigeonRegistrar.apiDelegate.pigeonApiWKNavigationResponse(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKNavigationResponse(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKFrameInfo { pigeonRegistrar.apiDelegate.pigeonApiWKFrameInfo(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? NSError { pigeonRegistrar.apiDelegate.pigeonApiNSError(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKScriptMessage { pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessage(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKSecurityOrigin { pigeonRegistrar.apiDelegate.pigeonApiWKSecurityOrigin(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? HTTPCookie { pigeonRegistrar.apiDelegate.pigeonApiHTTPCookie(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? AuthenticationChallengeResponse { - pigeonRegistrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKWebsiteDataStore { pigeonRegistrar.apiDelegate.pigeonApiWKWebsiteDataStore(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? UIScrollView { - pigeonRegistrar.apiDelegate.pigeonApiUIScrollView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIScrollView { + pigeonRegistrar.apiDelegate.pigeonApiUIScrollView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? WKWebViewConfiguration { - pigeonRegistrar.apiDelegate.pigeonApiWKWebViewConfiguration(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKWebViewConfiguration(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKUserContentController { - pigeonRegistrar.apiDelegate.pigeonApiWKUserContentController(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKUserContentController(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKPreferences { pigeonRegistrar.apiDelegate.pigeonApiWKPreferences(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKScriptMessageHandler { - pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessageHandler(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessageHandler(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKNavigationDelegate { - pigeonRegistrar.apiDelegate.pigeonApiWKNavigationDelegate(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKNavigationDelegate(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? WKWebView { - pigeonRegistrar.apiDelegate.pigeonApiUIViewWKWebView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? WKWebView { + pigeonRegistrar.apiDelegate.pigeonApiUIViewWKWebView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif #if !os(macOS) - if let instance = value as? UIView { - pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIView { + pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif #if !os(iOS) - if let instance = value as? WKWebView { - pigeonRegistrar.apiDelegate.pigeonApiNSViewWKWebView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? WKWebView { + pigeonRegistrar.apiDelegate.pigeonApiNSViewWKWebView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? WKWebView { @@ -859,42 +953,45 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKUIDelegate { pigeonRegistrar.apiDelegate.pigeonApiWKUIDelegate(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKHTTPCookieStore { pigeonRegistrar.apiDelegate.pigeonApiWKHTTPCookieStore(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? UIScrollViewDelegate { - pigeonRegistrar.apiDelegate.pigeonApiUIScrollViewDelegate(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIScrollViewDelegate { + pigeonRegistrar.apiDelegate.pigeonApiUIScrollViewDelegate(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? URLCredential { @@ -903,100 +1000,104 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? URLProtectionSpace { pigeonRegistrar.apiDelegate.pigeonApiURLProtectionSpace(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? URLAuthenticationChallenge { - pigeonRegistrar.apiDelegate.pigeonApiURLAuthenticationChallenge(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiURLAuthenticationChallenge(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? URL { pigeonRegistrar.apiDelegate.pigeonApiURL(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if #available(iOS 13.0.0, macOS 10.15.0, *), let instance = value as? WKWebpagePreferences { - pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? GetTrustResultResponse { - pigeonRegistrar.apiDelegate.pigeonApiGetTrustResultResponse(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiGetTrustResultResponse(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? SecTrustWrapper { pigeonRegistrar.apiDelegate.pigeonApiSecTrust(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? SecCertificateWrapper { pigeonRegistrar.apiDelegate.pigeonApiSecCertificate(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? NSObject { pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - - if let instance = value as AnyObject?, pigeonRegistrar.instanceManager.containsInstance(instance) + if let instance = value as AnyObject?, + pigeonRegistrar.instanceManager.containsInstance(instance) { super.writeByte(128) super.writeValue( @@ -1014,11 +1115,13 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand } override func reader(with data: Data) -> FlutterStandardReader { - return WebKitLibraryPigeonInternalProxyApiCodecReader(data: data, pigeonRegistrar: pigeonRegistrar) + return WebKitLibraryPigeonInternalProxyApiCodecReader( + data: data, pigeonRegistrar: pigeonRegistrar) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return WebKitLibraryPigeonInternalProxyApiCodecWriter(data: data, pigeonRegistrar: pigeonRegistrar) + return WebKitLibraryPigeonInternalProxyApiCodecWriter( + data: data, pigeonRegistrar: pigeonRegistrar) } } @@ -1479,27 +1582,36 @@ class WebKitLibraryPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable } protocol PigeonApiDelegateURLRequest { - func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws -> URLRequestWrapper + func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws + -> URLRequestWrapper /// The URL being requested. func getUrl(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? /// The HTTP request method. - func setHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws + func setHttpMethod( + pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws /// The HTTP request method. - func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? + func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws + -> String? /// The request body. - func setHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, body: FlutterStandardTypedData?) throws + func setHttpBody( + pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, + body: FlutterStandardTypedData?) throws /// The request body. - func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> FlutterStandardTypedData? + func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws + -> FlutterStandardTypedData? /// A dictionary containing all of the HTTP header fields for a request. - func setAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) throws + func setAllHttpHeaderFields( + pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) + throws /// A dictionary containing all of the HTTP header fields for a request. - func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> [String: String]? + func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) + throws -> [String: String]? } protocol PigeonApiProtocolURLRequest { } -final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { +final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLRequest ///An implementation of [NSObject] used to access callback methods @@ -1507,17 +1619,23 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLRequest) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLRequest) + { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLRequest?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLRequest? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1525,8 +1643,8 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { let urlArg = args[1] as! String do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: urlArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: urlArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1535,13 +1653,16 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getUrl", binaryMessenger: binaryMessenger, codec: codec) + let getUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getUrl", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getUrlChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1550,14 +1671,17 @@ withIdentifier: pigeonIdentifierArg) } else { getUrlChannel.setMessageHandler(nil) } - let setHttpMethodChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpMethod", binaryMessenger: binaryMessenger, codec: codec) + let setHttpMethodChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpMethod", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setHttpMethodChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let methodArg: String? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setHttpMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg, method: methodArg) + try api.pigeonDelegate.setHttpMethod( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, method: methodArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1566,13 +1690,16 @@ withIdentifier: pigeonIdentifierArg) } else { setHttpMethodChannel.setMessageHandler(nil) } - let getHttpMethodChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpMethod", binaryMessenger: binaryMessenger, codec: codec) + let getHttpMethodChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpMethod", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHttpMethodChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getHttpMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getHttpMethod( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1581,14 +1708,17 @@ withIdentifier: pigeonIdentifierArg) } else { getHttpMethodChannel.setMessageHandler(nil) } - let setHttpBodyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpBody", binaryMessenger: binaryMessenger, codec: codec) + let setHttpBodyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpBody", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setHttpBodyChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let bodyArg: FlutterStandardTypedData? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setHttpBody(pigeonApi: api, pigeonInstance: pigeonInstanceArg, body: bodyArg) + try api.pigeonDelegate.setHttpBody( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, body: bodyArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1597,13 +1727,16 @@ withIdentifier: pigeonIdentifierArg) } else { setHttpBodyChannel.setMessageHandler(nil) } - let getHttpBodyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpBody", binaryMessenger: binaryMessenger, codec: codec) + let getHttpBodyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpBody", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHttpBodyChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getHttpBody(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getHttpBody( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1612,14 +1745,17 @@ withIdentifier: pigeonIdentifierArg) } else { getHttpBodyChannel.setMessageHandler(nil) } - let setAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setAllHttpHeaderFields", binaryMessenger: binaryMessenger, codec: codec) + let setAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setAllHttpHeaderFields", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAllHttpHeaderFieldsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let fieldsArg: [String: String]? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setAllHttpHeaderFields(pigeonApi: api, pigeonInstance: pigeonInstanceArg, fields: fieldsArg) + try api.pigeonDelegate.setAllHttpHeaderFields( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, fields: fieldsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1628,13 +1764,16 @@ withIdentifier: pigeonIdentifierArg) } else { setAllHttpHeaderFieldsChannel.setMessageHandler(nil) } - let getAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getAllHttpHeaderFields", binaryMessenger: binaryMessenger, codec: codec) + let getAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getAllHttpHeaderFields", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAllHttpHeaderFieldsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getAllHttpHeaderFields(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAllHttpHeaderFields( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1646,21 +1785,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of URLRequest and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLRequestWrapper, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLRequestWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -1680,13 +1824,14 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateHTTPURLResponse { /// The response’s HTTP status code. - func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 + func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws + -> Int64 } protocol PigeonApiProtocolHTTPURLResponse { } -final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { +final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateHTTPURLResponse ///An implementation of [URLResponse] used to access callback methods @@ -1694,27 +1839,36 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { return pigeonRegistrar.apiDelegate.pigeonApiURLResponse(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPURLResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateHTTPURLResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of HTTPURLResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: HTTPURLResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: HTTPURLResponse, 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) { + } 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) + } 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) + 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))) @@ -1738,7 +1892,7 @@ open class PigeonApiDelegateURLResponse { protocol PigeonApiProtocolURLResponse { } -final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { +final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLResponse ///An implementation of [NSObject] used to access callback methods @@ -1746,26 +1900,33 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of URLResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLResponse, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -1786,20 +1947,25 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { protocol PigeonApiDelegateWKUserScript { /// Creates a user script object that contains the specified source code and /// attributes. - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, isForMainFrameOnly: Bool) throws -> WKUserScript + func pigeonDefaultConstructor( + pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, + isForMainFrameOnly: Bool + ) throws -> WKUserScript /// The script’s source code. func source(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> String /// The time at which to inject the script into the webpage. - func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> UserScriptInjectionTime + func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws + -> UserScriptInjectionTime /// A Boolean value that indicates whether to inject the script into the main /// frame or all frames. - func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> Bool + func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws + -> Bool } protocol PigeonApiProtocolWKUserScript { } -final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { +final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUserScript ///An implementation of [NSObject] used to access callback methods @@ -1807,17 +1973,24 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserScript) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserScript + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserScript?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserScript? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1827,8 +2000,10 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { let isForMainFrameOnlyArg = args[3] as! Bool do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, source: sourceArg, injectionTime: injectionTimeArg, isForMainFrameOnly: isForMainFrameOnlyArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, source: sourceArg, injectionTime: injectionTimeArg, + isForMainFrameOnly: isForMainFrameOnlyArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1840,25 +2015,34 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKUserScript and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKUserScript, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKUserScript, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -1877,19 +2061,22 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateWKNavigationAction { /// The URL request object associated with the navigation action. - func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper + func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws + -> URLRequestWrapper /// The frame in which to display the new content. /// /// If the target of the navigation is a new window, this property is nil. - func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> WKFrameInfo? + func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) + throws -> WKFrameInfo? /// The type of action that triggered the navigation. - func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> NavigationType + func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) + throws -> NavigationType } protocol PigeonApiProtocolWKNavigationAction { } -final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { +final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationAction ///An implementation of [NSObject] used to access callback methods @@ -1897,30 +2084,42 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationAction) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKNavigationAction + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKNavigationAction and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKNavigationAction, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKNavigationAction, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -1939,16 +2138,19 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { } protocol PigeonApiDelegateWKNavigationResponse { /// The frame’s response. - func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse + func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) + throws -> URLResponse /// A Boolean value that indicates whether the response targets the web view’s /// main frame. - func isForMainFrame(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> Bool + func isForMainFrame( + pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse + ) throws -> Bool } protocol PigeonApiProtocolWKNavigationResponse { } -final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse { +final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationResponse ///An implementation of [NSObject] used to access callback methods @@ -1956,29 +2158,40 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKNavigationResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKNavigationResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKNavigationResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKNavigationResponse, 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) { + } 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) + } 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 + 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 @@ -2000,13 +2213,14 @@ protocol PigeonApiDelegateWKFrameInfo { /// or a subframe. func isMainFrame(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> Bool /// The frame’s current request. - func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> URLRequestWrapper? + func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws + -> URLRequestWrapper? } protocol PigeonApiProtocolWKFrameInfo { } -final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { +final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKFrameInfo ///An implementation of [NSObject] used to access callback methods @@ -2014,28 +2228,36 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKFrameInfo) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKFrameInfo + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKFrameInfo and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKFrameInfo, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKFrameInfo, 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) { + } 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) + } 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) + 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))) @@ -2065,7 +2287,7 @@ protocol PigeonApiDelegateNSError { protocol PigeonApiProtocolNSError { } -final class PigeonApiNSError: PigeonApiProtocolNSError { +final class PigeonApiNSError: PigeonApiProtocolNSError { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSError ///An implementation of [NSObject] used to access callback methods @@ -2078,25 +2300,32 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { self.pigeonDelegate = delegate } ///Creates a Dart instance of NSError and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: NSError, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: NSError, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2123,7 +2352,7 @@ protocol PigeonApiDelegateWKScriptMessage { protocol PigeonApiProtocolWKScriptMessage { } -final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { +final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKScriptMessage ///An implementation of [NSObject] used to access callback methods @@ -2131,28 +2360,36 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKScriptMessage) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKScriptMessage + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKScriptMessage and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKScriptMessage, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKScriptMessage, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -2176,13 +2413,14 @@ protocol PigeonApiDelegateWKSecurityOrigin { /// The security origin's port. func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 /// The security origin's protocol. - func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String + func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) + throws -> String } protocol PigeonApiProtocolWKSecurityOrigin { } -final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { +final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKSecurityOrigin ///An implementation of [NSObject] used to access callback methods @@ -2190,30 +2428,40 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKSecurityOrigin) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKSecurityOrigin + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKSecurityOrigin and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKSecurityOrigin, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKSecurityOrigin, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2231,15 +2479,18 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { } } protocol PigeonApiDelegateHTTPCookie { - func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie + func pigeonDefaultConstructor( + pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any] + ) throws -> HTTPCookie /// The cookie’s properties. - func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws -> [HttpCookiePropertyKey: Any]? + func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws + -> [HttpCookiePropertyKey: Any]? } protocol PigeonApiProtocolHTTPCookie { } -final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { +final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateHTTPCookie ///An implementation of [NSObject] used to access callback methods @@ -2247,17 +2498,23 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPCookie) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPCookie) + { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiHTTPCookie?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiHTTPCookie? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2265,8 +2522,9 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { let propertiesArg = args[1] as? [HttpCookiePropertyKey: Any] do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, properties: propertiesArg!), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, properties: propertiesArg!), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2275,13 +2533,16 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let getPropertiesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.getProperties", binaryMessenger: binaryMessenger, codec: codec) + let getPropertiesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.getProperties", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getPropertiesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! HTTPCookie do { - let result = try api.pigeonDelegate.getProperties(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getProperties( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -2293,21 +2554,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of HTTPCookie and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: HTTPCookie, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: HTTPCookie, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -2326,31 +2592,51 @@ withIdentifier: pigeonIdentifierArg) } } protocol PigeonApiDelegateAuthenticationChallengeResponse { - func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse + func pigeonDefaultConstructor( + pigeonApi: PigeonApiAuthenticationChallengeResponse, + disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential? + ) throws -> AuthenticationChallengeResponse /// The option to use to handle the challenge. - func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition + func disposition( + pigeonApi: PigeonApiAuthenticationChallengeResponse, + pigeonInstance: AuthenticationChallengeResponse + ) throws -> UrlSessionAuthChallengeDisposition /// The credential to use for authentication when the disposition parameter /// contains the value URLSession.AuthChallengeDisposition.useCredential. - func credential(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> URLCredential? + func credential( + pigeonApi: PigeonApiAuthenticationChallengeResponse, + pigeonInstance: AuthenticationChallengeResponse + ) throws -> URLCredential? } protocol PigeonApiProtocolAuthenticationChallengeResponse { } -final class PigeonApiAuthenticationChallengeResponse: PigeonApiProtocolAuthenticationChallengeResponse { +final class PigeonApiAuthenticationChallengeResponse: + PigeonApiProtocolAuthenticationChallengeResponse +{ unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateAuthenticationChallengeResponse - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateAuthenticationChallengeResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateAuthenticationChallengeResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiAuthenticationChallengeResponse?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiAuthenticationChallengeResponse? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2359,8 +2645,9 @@ final class PigeonApiAuthenticationChallengeResponse: PigeonApiProtocolAuthentic let credentialArg: URLCredential? = nilOrValue(args[2]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, disposition: dispositionArg, credential: credentialArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, disposition: dispositionArg, credential: credentialArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2372,24 +2659,33 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of AuthenticationChallengeResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: AuthenticationChallengeResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: AuthenticationChallengeResponse, + 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) { + } 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) + } 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 + 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 @@ -2410,15 +2706,19 @@ protocol PigeonApiDelegateWKWebsiteDataStore { /// The default data store, which stores data persistently to disk. func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore) throws -> WKWebsiteDataStore /// The object that manages the HTTP cookies for your website. - func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore) throws -> WKHTTPCookieStore + func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore) + throws -> WKHTTPCookieStore /// Removes the specified types of website data from one or more data records. - func removeDataOfTypes(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, completion: @escaping (Result) -> Void) + func removeDataOfTypes( + pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, + dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, + completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolWKWebsiteDataStore { } -final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { +final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebsiteDataStore ///An implementation of [NSObject] used to access callback methods @@ -2426,23 +2726,33 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebsiteDataStore) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKWebsiteDataStore + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebsiteDataStore?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebsiteDataStore? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let defaultDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.defaultDataStore", binaryMessenger: binaryMessenger, codec: codec) + let defaultDataStoreChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.defaultDataStore", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { defaultDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.defaultDataStore(pigeonApi: api), withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.defaultDataStore(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2451,14 +2761,19 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } else { defaultDataStoreChannel.setMessageHandler(nil) } - let httpCookieStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.httpCookieStore", binaryMessenger: binaryMessenger, codec: codec) + let httpCookieStoreChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.httpCookieStore", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { httpCookieStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebsiteDataStore let pigeonIdentifierArg = args[1] as! Int64 do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.httpCookieStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.httpCookieStore( + pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2467,14 +2782,19 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } else { httpCookieStoreChannel.setMessageHandler(nil) } - let removeDataOfTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.removeDataOfTypes", binaryMessenger: binaryMessenger, codec: codec) + let removeDataOfTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.removeDataOfTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeDataOfTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebsiteDataStore let dataTypesArg = args[1] as! [WebsiteDataType] let modificationTimeInSecondsSinceEpochArg = args[2] as! Double - api.pigeonDelegate.removeDataOfTypes(pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataTypes: dataTypesArg, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpochArg) { result in + api.pigeonDelegate.removeDataOfTypes( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataTypes: dataTypesArg, + modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpochArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2489,21 +2809,26 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } ///Creates a Dart instance of WKWebsiteDataStore and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebsiteDataStore, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKWebsiteDataStore, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -2523,19 +2848,20 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } protocol PigeonApiDelegateUIView { #if !os(macOS) - /// The view’s background color. - func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) throws + /// The view’s background color. + func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) + throws #endif #if !os(macOS) - /// A Boolean value that determines whether the view is opaque. - func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws + /// A Boolean value that determines whether the view is opaque. + func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws #endif } protocol PigeonApiProtocolUIView { } -final class PigeonApiUIView: PigeonApiProtocolUIView { +final class PigeonApiUIView: PigeonApiProtocolUIView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIView ///An implementation of [NSObject] used to access callback methods @@ -2551,140 +2877,162 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let setBackgroundColorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setBackgroundColor", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBackgroundColorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIView - let valueArg: Int64? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setBackgroundColor(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setBackgroundColorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setBackgroundColor", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBackgroundColorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIView + let valueArg: Int64? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setBackgroundColor( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setBackgroundColorChannel.setMessageHandler(nil) } - } else { - setBackgroundColorChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setOpaqueChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setOpaque", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setOpaqueChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIView - let opaqueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setOpaque(pigeonApi: api, pigeonInstance: pigeonInstanceArg, opaque: opaqueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setOpaqueChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setOpaque", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setOpaqueChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIView + let opaqueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setOpaque( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, opaque: opaqueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setOpaqueChannel.setMessageHandler(nil) } - } else { - setOpaqueChannel.setMessageHandler(nil) - } #endif } #if !os(macOS) - ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: UIView, 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.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(())) + ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: UIView, 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.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(())) + } } } } - } #endif } protocol PigeonApiDelegateUIScrollView { #if !os(macOS) - /// The point at which the origin of the content view is offset from the - /// origin of the scroll view. - func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws -> [Double] + /// The point at which the origin of the content view is offset from the + /// origin of the scroll view. + func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws + -> [Double] #endif #if !os(macOS) - /// Move the scrolled position of your view. - /// - /// Convenience method to synchronize change to the x and y scroll position. - func scrollBy(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws + /// Move the scrolled position of your view. + /// + /// Convenience method to synchronize change to the x and y scroll position. + func scrollBy( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws #endif #if !os(macOS) - /// The point at which the origin of the content view is offset from the - /// origin of the scroll view. - func setContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws + /// The point at which the origin of the content view is offset from the + /// origin of the scroll view. + func setContentOffset( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws #endif #if !os(macOS) - /// The delegate of the scroll view. - func setDelegate(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, delegate: UIScrollViewDelegate?) throws + /// The delegate of the scroll view. + func setDelegate( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, + delegate: UIScrollViewDelegate?) throws #endif #if !os(macOS) - /// Whether the scroll view bounces past the edge of content and back again. - func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces past the edge of content and back again. + func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) + throws #endif #if !os(macOS) - /// Whether the scroll view bounces when it reaches the ends of its horizontal - /// axis. - func setBouncesHorizontally(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces when it reaches the ends of its horizontal + /// axis. + func setBouncesHorizontally( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether the scroll view bounces when it reaches the ends of its vertical - /// axis. - func setBouncesVertically(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces when it reaches the ends of its vertical + /// axis. + func setBouncesVertically( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether bouncing always occurs when vertical scrolling reaches the end of - /// the content. - /// - /// If the value of this property is true and `bouncesVertically` is true, the - /// scroll view allows vertical dragging even if the content is smaller than - /// the bounds of the scroll view. - func setAlwaysBounceVertical(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether bouncing always occurs when vertical scrolling reaches the end of + /// the content. + /// + /// If the value of this property is true and `bouncesVertically` is true, the + /// scroll view allows vertical dragging even if the content is smaller than + /// the bounds of the scroll view. + func setAlwaysBounceVertical( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether bouncing always occurs when horizontal scrolling reaches the end - /// of the content view. - /// - /// If the value of this property is true and `bouncesHorizontally` is true, - /// the scroll view allows horizontal dragging even if the content is smaller - /// than the bounds of the scroll view. - func setAlwaysBounceHorizontal(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether bouncing always occurs when horizontal scrolling reaches the end + /// of the content view. + /// + /// If the value of this property is true and `bouncesHorizontally` is true, + /// the scroll view allows horizontal dragging even if the content is smaller + /// than the bounds of the scroll view. + func setAlwaysBounceHorizontal( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif } protocol PigeonApiProtocolUIScrollView { } -final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { +final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIScrollView ///An implementation of [UIView] used to access callback methods @@ -2692,251 +3040,309 @@ final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { return pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollView) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollView + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollView?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollView? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let getContentOffsetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.getContentOffset", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getContentOffsetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - do { - let result = try api.pigeonDelegate.getContentOffset(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getContentOffsetChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.getContentOffset", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getContentOffsetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + do { + let result = try api.pigeonDelegate.getContentOffset( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getContentOffsetChannel.setMessageHandler(nil) } - } else { - getContentOffsetChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let scrollByChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.scrollBy", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - scrollByChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let xArg = args[1] as! Double - let yArg = args[2] as! Double - do { - try api.pigeonDelegate.scrollBy(pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let scrollByChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.scrollBy", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + scrollByChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let xArg = args[1] as! Double + let yArg = args[2] as! Double + do { + try api.pigeonDelegate.scrollBy( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + scrollByChannel.setMessageHandler(nil) } - } else { - scrollByChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setContentOffsetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setContentOffset", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setContentOffsetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let xArg = args[1] as! Double - let yArg = args[2] as! Double - do { - try api.pigeonDelegate.setContentOffset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setContentOffsetChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setContentOffset", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setContentOffsetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let xArg = args[1] as! Double + let yArg = args[2] as! Double + do { + try api.pigeonDelegate.setContentOffset( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setContentOffsetChannel.setMessageHandler(nil) } - } else { - setContentOffsetChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let delegateArg: UIScrollViewDelegate? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let delegateArg: UIScrollViewDelegate? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setDelegateChannel.setMessageHandler(nil) } - } else { - setDelegateChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setBouncesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBounces", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBounces(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setBouncesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBounces", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBounces( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setBouncesChannel.setMessageHandler(nil) } - } else { - setBouncesChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setBouncesHorizontallyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesHorizontally", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesHorizontallyChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBouncesHorizontally(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setBouncesHorizontallyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesHorizontally", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesHorizontallyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBouncesHorizontally( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setBouncesHorizontallyChannel.setMessageHandler(nil) } - } else { - setBouncesHorizontallyChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setBouncesVerticallyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesVertically", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesVerticallyChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBouncesVertically(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setBouncesVerticallyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesVertically", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesVerticallyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBouncesVertically( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setBouncesVerticallyChannel.setMessageHandler(nil) } - } else { - setBouncesVerticallyChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setAlwaysBounceVerticalChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceVertical", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAlwaysBounceVerticalChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAlwaysBounceVertical(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAlwaysBounceVerticalChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceVertical", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAlwaysBounceVerticalChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAlwaysBounceVertical( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAlwaysBounceVerticalChannel.setMessageHandler(nil) } - } else { - setAlwaysBounceVerticalChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setAlwaysBounceHorizontalChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceHorizontal", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAlwaysBounceHorizontalChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAlwaysBounceHorizontal(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAlwaysBounceHorizontalChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceHorizontal", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAlwaysBounceHorizontalChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAlwaysBounceHorizontal( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAlwaysBounceHorizontalChannel.setMessageHandler(nil) } - } else { - setAlwaysBounceHorizontalChannel.setMessageHandler(nil) - } #endif } #if !os(macOS) - ///Creates a Dart instance of UIScrollView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: UIScrollView, 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.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(())) + ///Creates a Dart instance of UIScrollView and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: UIScrollView, 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.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(())) + } } } } - } #endif } protocol PigeonApiDelegateWKWebViewConfiguration { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws + -> WKWebViewConfiguration /// The object that coordinates interactions between your app’s native code /// and the webpage’s scripts and other content. - func setUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, controller: WKUserContentController) throws + func setUserContentController( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, + controller: WKUserContentController) throws /// The object that coordinates interactions between your app’s native code /// and the webpage’s scripts and other content. - func getUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKUserContentController + func getUserContentController( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKUserContentController /// The object you use to get and set the site’s cookies and to track the /// cached data objects. - func setWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, dataStore: WKWebsiteDataStore) throws + func setWebsiteDataStore( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, + dataStore: WKWebsiteDataStore) throws /// The object you use to get and set the site’s cookies and to track the /// cached data objects. - func getWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebsiteDataStore + func getWebsiteDataStore( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKWebsiteDataStore /// The object that manages the preference-related settings for the web view. - func setPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, preferences: WKPreferences) throws + func setPreferences( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, + preferences: WKPreferences) throws /// The object that manages the preference-related settings for the web view. - func getPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKPreferences + func getPreferences( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKPreferences /// A Boolean value that indicates whether HTML5 videos play inline or use the /// native full-screen controller. - func setAllowsInlineMediaPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) throws + func setAllowsInlineMediaPlayback( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) + throws /// A Boolean value that indicates whether the web view limits navigation to /// pages within the app’s domain. - func setLimitsNavigationsToAppBoundDomains(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) throws + func setLimitsNavigationsToAppBoundDomains( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) + throws /// The media types that require a user gesture to begin playing. - func setMediaTypesRequiringUserActionForPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, type: AudiovisualMediaType) throws + 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 + func getDefaultWebpagePreferences( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKWebpagePreferences } protocol PigeonApiProtocolWKWebViewConfiguration { } -final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfiguration { +final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfiguration { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebViewConfiguration ///An implementation of [NSObject] used to access callback methods @@ -2944,25 +3350,34 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebViewConfiguration) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKWebViewConfiguration + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebViewConfiguration?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebViewConfiguration? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2971,14 +3386,18 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setUserContentControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setUserContentController", binaryMessenger: binaryMessenger, codec: codec) + let setUserContentControllerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setUserContentController", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setUserContentControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let controllerArg = args[1] as! WKUserContentController do { - try api.pigeonDelegate.setUserContentController(pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) + try api.pigeonDelegate.setUserContentController( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2987,13 +3406,17 @@ withIdentifier: pigeonIdentifierArg) } else { setUserContentControllerChannel.setMessageHandler(nil) } - let getUserContentControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getUserContentController", binaryMessenger: binaryMessenger, codec: codec) + let getUserContentControllerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getUserContentController", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getUserContentControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getUserContentController(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getUserContentController( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3002,14 +3425,18 @@ withIdentifier: pigeonIdentifierArg) } else { getUserContentControllerChannel.setMessageHandler(nil) } - let setWebsiteDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setWebsiteDataStore", binaryMessenger: binaryMessenger, codec: codec) + let setWebsiteDataStoreChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setWebsiteDataStore", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setWebsiteDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let dataStoreArg = args[1] as! WKWebsiteDataStore do { - try api.pigeonDelegate.setWebsiteDataStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataStore: dataStoreArg) + try api.pigeonDelegate.setWebsiteDataStore( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataStore: dataStoreArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3018,13 +3445,17 @@ withIdentifier: pigeonIdentifierArg) } else { setWebsiteDataStoreChannel.setMessageHandler(nil) } - let getWebsiteDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getWebsiteDataStore", binaryMessenger: binaryMessenger, codec: codec) + let getWebsiteDataStoreChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getWebsiteDataStore", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getWebsiteDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getWebsiteDataStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getWebsiteDataStore( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3033,14 +3464,17 @@ withIdentifier: pigeonIdentifierArg) } else { getWebsiteDataStoreChannel.setMessageHandler(nil) } - let setPreferencesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setPreferences", binaryMessenger: binaryMessenger, codec: codec) + let setPreferencesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setPreferences", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setPreferencesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let preferencesArg = args[1] as! WKPreferences do { - try api.pigeonDelegate.setPreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg, preferences: preferencesArg) + try api.pigeonDelegate.setPreferences( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, preferences: preferencesArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3049,13 +3483,16 @@ withIdentifier: pigeonIdentifierArg) } else { setPreferencesChannel.setMessageHandler(nil) } - let getPreferencesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getPreferences", binaryMessenger: binaryMessenger, codec: codec) + let getPreferencesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getPreferences", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getPreferencesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getPreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getPreferences( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3064,14 +3501,18 @@ withIdentifier: pigeonIdentifierArg) } else { getPreferencesChannel.setMessageHandler(nil) } - let setAllowsInlineMediaPlaybackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setAllowsInlineMediaPlayback", binaryMessenger: binaryMessenger, codec: codec) + let setAllowsInlineMediaPlaybackChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setAllowsInlineMediaPlayback", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAllowsInlineMediaPlaybackChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let allowArg = args[1] as! Bool do { - try api.pigeonDelegate.setAllowsInlineMediaPlayback(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + try api.pigeonDelegate.setAllowsInlineMediaPlayback( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3080,14 +3521,18 @@ withIdentifier: pigeonIdentifierArg) } else { setAllowsInlineMediaPlaybackChannel.setMessageHandler(nil) } - let setLimitsNavigationsToAppBoundDomainsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains", binaryMessenger: binaryMessenger, codec: codec) + let setLimitsNavigationsToAppBoundDomainsChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLimitsNavigationsToAppBoundDomainsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let limitArg = args[1] as! Bool do { - try api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains(pigeonApi: api, pigeonInstance: pigeonInstanceArg, limit: limitArg) + try api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, limit: limitArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3096,14 +3541,18 @@ withIdentifier: pigeonIdentifierArg) } else { setLimitsNavigationsToAppBoundDomainsChannel.setMessageHandler(nil) } - let setMediaTypesRequiringUserActionForPlaybackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback", binaryMessenger: binaryMessenger, codec: codec) + let setMediaTypesRequiringUserActionForPlaybackChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setMediaTypesRequiringUserActionForPlaybackChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let typeArg = args[1] as! AudiovisualMediaType do { - try api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback(pigeonApi: api, pigeonInstance: pigeonInstanceArg, type: typeArg) + try api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, type: typeArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3113,13 +3562,17 @@ withIdentifier: pigeonIdentifierArg) 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) + 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) + let result = try api.pigeonDelegate.getDefaultWebpagePreferences( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3128,16 +3581,21 @@ withIdentifier: pigeonIdentifierArg) } else { getDefaultWebpagePreferencesChannel.setMessageHandler(nil) } - } else { + } else { let getDefaultWebpagePreferencesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getDefaultWebpagePreferences", + 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 - ))) + 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) @@ -3146,21 +3604,27 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKWebViewConfiguration and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebViewConfiguration, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKWebViewConfiguration, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -3180,23 +3644,31 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateWKUserContentController { /// Installs a message handler that you can call from your JavaScript code. - func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws + func addScriptMessageHandler( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, + handler: WKScriptMessageHandler, name: String) throws /// Uninstalls the custom message handler with the specified name from your /// JavaScript code. - func removeScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, name: String) throws + func removeScriptMessageHandler( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, + name: String) throws /// Uninstalls all custom message handlers associated with the user content /// controller. - func removeAllScriptMessageHandlers(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws + func removeAllScriptMessageHandlers( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws /// Injects the specified script into the webpage’s content. - func addUserScript(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, userScript: WKUserScript) throws + func addUserScript( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, + userScript: WKUserScript) throws /// Removes all user scripts from the web view. - func removeAllUserScripts(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws + func removeAllUserScripts( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws } protocol PigeonApiProtocolWKUserContentController { } -final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentController { +final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentController { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUserContentController ///An implementation of [NSObject] used to access callback methods @@ -3204,17 +3676,26 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserContentController) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKUserContentController + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserContentController?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserContentController? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let addScriptMessageHandlerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addScriptMessageHandler", binaryMessenger: binaryMessenger, codec: codec) + let addScriptMessageHandlerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addScriptMessageHandler", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { addScriptMessageHandlerChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3222,7 +3703,8 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont let handlerArg = args[1] as! WKScriptMessageHandler let nameArg = args[2] as! String do { - try api.pigeonDelegate.addScriptMessageHandler(pigeonApi: api, pigeonInstance: pigeonInstanceArg, handler: handlerArg, name: nameArg) + try api.pigeonDelegate.addScriptMessageHandler( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, handler: handlerArg, name: nameArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3231,14 +3713,18 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { addScriptMessageHandlerChannel.setMessageHandler(nil) } - let removeScriptMessageHandlerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeScriptMessageHandler", binaryMessenger: binaryMessenger, codec: codec) + let removeScriptMessageHandlerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeScriptMessageHandler", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeScriptMessageHandlerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController let nameArg = args[1] as! String do { - try api.pigeonDelegate.removeScriptMessageHandler(pigeonApi: api, pigeonInstance: pigeonInstanceArg, name: nameArg) + try api.pigeonDelegate.removeScriptMessageHandler( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, name: nameArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3247,13 +3733,17 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { removeScriptMessageHandlerChannel.setMessageHandler(nil) } - let removeAllScriptMessageHandlersChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllScriptMessageHandlers", binaryMessenger: binaryMessenger, codec: codec) + let removeAllScriptMessageHandlersChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllScriptMessageHandlers", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeAllScriptMessageHandlersChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController do { - try api.pigeonDelegate.removeAllScriptMessageHandlers(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.removeAllScriptMessageHandlers( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3262,14 +3752,17 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { removeAllScriptMessageHandlersChannel.setMessageHandler(nil) } - let addUserScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addUserScript", binaryMessenger: binaryMessenger, codec: codec) + let addUserScriptChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addUserScript", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { addUserScriptChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController let userScriptArg = args[1] as! WKUserScript do { - try api.pigeonDelegate.addUserScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userScript: userScriptArg) + try api.pigeonDelegate.addUserScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, userScript: userScriptArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3278,13 +3771,17 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { addUserScriptChannel.setMessageHandler(nil) } - let removeAllUserScriptsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllUserScripts", binaryMessenger: binaryMessenger, codec: codec) + let removeAllUserScriptsChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllUserScripts", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeAllUserScriptsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController do { - try api.pigeonDelegate.removeAllUserScripts(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.removeAllUserScripts( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3296,21 +3793,27 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } ///Creates a Dart instance of WKUserContentController and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKUserContentController, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKUserContentController, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -3330,13 +3833,14 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } protocol PigeonApiDelegateWKPreferences { /// A Boolean value that indicates whether JavaScript is enabled. - func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws + func setJavaScriptEnabled( + pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws } protocol PigeonApiProtocolWKPreferences { } -final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { +final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKPreferences ///An implementation of [NSObject] used to access callback methods @@ -3344,24 +3848,32 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKPreferences) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKPreferences + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKPreferences?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKPreferences? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setJavaScriptEnabledChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.setJavaScriptEnabled", binaryMessenger: binaryMessenger, codec: codec) + let setJavaScriptEnabledChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.setJavaScriptEnabled", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setJavaScriptEnabledChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKPreferences let enabledArg = args[1] as! Bool do { - try api.pigeonDelegate.setJavaScriptEnabled(pigeonApi: api, pigeonInstance: pigeonInstanceArg, enabled: enabledArg) + try api.pigeonDelegate.setJavaScriptEnabled( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, enabled: enabledArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3373,21 +3885,26 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } ///Creates a Dart instance of WKPreferences and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKPreferences, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKPreferences, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -3406,15 +3923,19 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } } protocol PigeonApiDelegateWKScriptMessageHandler { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws + -> WKScriptMessageHandler } protocol PigeonApiProtocolWKScriptMessageHandler { /// Tells the handler that a webpage sent a script message. - func didReceiveScriptMessage(pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, completion: @escaping (Result) -> Void) + func didReceiveScriptMessage( + pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, + controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, + completion: @escaping (Result) -> Void) } -final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHandler { +final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHandler { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKScriptMessageHandler ///An implementation of [NSObject] used to access callback methods @@ -3422,25 +3943,34 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKScriptMessageHandler) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKScriptMessageHandler + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKScriptMessageHandler?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKScriptMessageHandler? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3452,25 +3982,34 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKScriptMessageHandler and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKScriptMessageHandler, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKScriptMessageHandler, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + message: + "Error: Attempting to create a new Dart instance of WKScriptMessageHandler, but the class has a nonnull callback method.", + details: ""))) } } /// Tells the handler that a webpage sent a script message. - func didReceiveScriptMessage(pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, completion: @escaping (Result) -> Void) { + func didReceiveScriptMessage( + pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, + controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3481,8 +4020,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.didReceiveScriptMessage" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.didReceiveScriptMessage" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, controllerArg, messageArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3501,27 +4042,44 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateWKNavigationDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws + -> WKNavigationDelegate } protocol PigeonApiProtocolWKNavigationDelegate { /// Tells the delegate that navigation is complete. - func didFinishNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) + func didFinishNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + url urlArg: String?, completion: @escaping (Result) -> Void) /// Tells the delegate that navigation from the main frame has started. - func didStartProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) + func didStartProvisionalNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + url urlArg: String?, completion: @escaping (Result) -> Void) /// Asks the delegate for permission to navigate to new content based on the /// specified action information. - func decidePolicyForNavigationAction(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) + func decidePolicyForNavigationAction( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + navigationAction navigationActionArg: WKNavigationAction, + completion: @escaping (Result) -> Void) /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. - func decidePolicyForNavigationResponse(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationResponse navigationResponseArg: WKNavigationResponse, completion: @escaping (Result) -> Void) + func decidePolicyForNavigationResponse( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + navigationResponse navigationResponseArg: WKNavigationResponse, + completion: @escaping (Result) -> Void) /// Tells the delegate that an error occurred during navigation. - func didFailNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) + func didFailNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + error errorArg: NSError, completion: @escaping (Result) -> Void) /// Tells the delegate that an error occurred during the early navigation /// process. - func didFailProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) + func didFailProvisionalNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + error errorArg: NSError, completion: @escaping (Result) -> Void) /// Tells the delegate that the web view’s content process was terminated. - func webViewWebContentProcessDidTerminate(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, completion: @escaping (Result) -> Void) + func webViewWebContentProcessDidTerminate( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + completion: @escaping (Result) -> Void) /// Asks the delegate to respond to an authentication challenge. /// /// This return value expects a List with: @@ -3533,10 +4091,13 @@ protocol PigeonApiProtocolWKNavigationDelegate { /// "password": "", /// "persistence": , /// ] - func didReceiveAuthenticationChallenge(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping (Result<[Any?], PigeonError>) -> Void) + func didReceiveAuthenticationChallenge( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + challenge challengeArg: URLAuthenticationChallenge, + completion: @escaping (Result<[Any?], PigeonError>) -> Void) } -final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate { +final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationDelegate ///An implementation of [NSObject] used to access callback methods @@ -3544,25 +4105,34 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationDelegate) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKNavigationDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKNavigationDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKNavigationDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3574,25 +4144,32 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKNavigationDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKNavigationDelegate, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKNavigationDelegate, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + 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. - func didFinishNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) { + func didFinishNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + url urlArg: String?, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3603,8 +4180,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFinishNavigation" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFinishNavigation" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, urlArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3622,7 +4201,10 @@ withIdentifier: pigeonIdentifierArg) } /// Tells the delegate that navigation from the main frame has started. - func didStartProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) { + func didStartProvisionalNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + url urlArg: String?, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3633,8 +4215,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didStartProvisionalNavigation" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didStartProvisionalNavigation" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, urlArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3653,7 +4237,11 @@ withIdentifier: pigeonIdentifierArg) /// Asks the delegate for permission to navigate to new content based on the /// specified action information. - func decidePolicyForNavigationAction(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) { + func decidePolicyForNavigationAction( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + navigationAction navigationActionArg: WKNavigationAction, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3664,9 +4252,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, navigationActionArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, navigationActionArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -3677,7 +4268,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! NavigationActionPolicy completion(.success(result)) @@ -3687,7 +4282,11 @@ withIdentifier: pigeonIdentifierArg) /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. - func decidePolicyForNavigationResponse(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationResponse navigationResponseArg: WKNavigationResponse, completion: @escaping (Result) -> Void) { + func decidePolicyForNavigationResponse( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + navigationResponse navigationResponseArg: WKNavigationResponse, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3698,9 +4297,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, navigationResponseArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, navigationResponseArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -3711,7 +4313,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! NavigationResponsePolicy completion(.success(result)) @@ -3720,7 +4326,10 @@ withIdentifier: pigeonIdentifierArg) } /// Tells the delegate that an error occurred during navigation. - func didFailNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) { + func didFailNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + error errorArg: NSError, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3731,8 +4340,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailNavigation" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailNavigation" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3751,7 +4362,10 @@ withIdentifier: pigeonIdentifierArg) /// Tells the delegate that an error occurred during the early navigation /// process. - func didFailProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) { + func didFailProvisionalNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + error errorArg: NSError, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3762,8 +4376,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailProvisionalNavigation" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailProvisionalNavigation" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3781,7 +4397,10 @@ withIdentifier: pigeonIdentifierArg) } /// Tells the delegate that the web view’s content process was terminated. - func webViewWebContentProcessDidTerminate(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, completion: @escaping (Result) -> Void) { + func webViewWebContentProcessDidTerminate( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3792,8 +4411,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.webViewWebContentProcessDidTerminate" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.webViewWebContentProcessDidTerminate" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3821,7 +4442,11 @@ withIdentifier: pigeonIdentifierArg) /// "password": "", /// "persistence": , /// ] - func didReceiveAuthenticationChallenge(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping (Result<[Any?], PigeonError>) -> Void) { + func didReceiveAuthenticationChallenge( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + challenge challengeArg: URLAuthenticationChallenge, + completion: @escaping (Result<[Any?], PigeonError>) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3832,8 +4457,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, challengeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3845,7 +4472,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! [Any?] completion(.success(result)) @@ -3858,41 +4489,52 @@ protocol PigeonApiDelegateNSObject { func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject /// Registers the observer object to receive KVO notifications for the key /// path relative to the object receiving this message. - func addObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, options: [KeyValueObservingOptions]) throws + func addObserver( + pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, + options: [KeyValueObservingOptions]) throws /// Stops the observer object from receiving change notifications for the /// property specified by the key path relative to the object receiving this /// message. - func removeObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) throws + func removeObserver( + pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) + throws } protocol PigeonApiProtocolNSObject { /// Informs the observing object when the value at the specified key path /// relative to the observed object has changed. - func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) + func observeValue( + pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, + object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, + completion: @escaping (Result) -> Void) } -final class PigeonApiNSObject: PigeonApiProtocolNSObject { +final class PigeonApiNSObject: PigeonApiProtocolNSObject { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSObject init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSObject) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSObject?) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSObject?) + { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3901,7 +4543,9 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let addObserverChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.addObserver", binaryMessenger: binaryMessenger, codec: codec) + let addObserverChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.addObserver", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { addObserverChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3910,7 +4554,9 @@ withIdentifier: pigeonIdentifierArg) let keyPathArg = args[2] as! String let optionsArg = args[3] as! [KeyValueObservingOptions] do { - try api.pigeonDelegate.addObserver(pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, keyPath: keyPathArg, options: optionsArg) + try api.pigeonDelegate.addObserver( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, + keyPath: keyPathArg, options: optionsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3919,7 +4565,9 @@ withIdentifier: pigeonIdentifierArg) } else { addObserverChannel.setMessageHandler(nil) } - let removeObserverChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.removeObserver", binaryMessenger: binaryMessenger, codec: codec) + let removeObserverChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.removeObserver", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeObserverChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3927,7 +4575,9 @@ withIdentifier: pigeonIdentifierArg) let observerArg = args[1] as! NSObject let keyPathArg = args[2] as! String do { - try api.pigeonDelegate.removeObserver(pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, keyPath: keyPathArg) + try api.pigeonDelegate.removeObserver( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, + keyPath: keyPathArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3939,21 +4589,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of NSObject and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: NSObject, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: NSObject, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -3972,7 +4627,11 @@ withIdentifier: pigeonIdentifierArg) } /// Informs the observing object when the value at the specified key path /// relative to the observed object has changed. - func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) { + func observeValue( + pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, + object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3984,8 +4643,10 @@ withIdentifier: pigeonIdentifierArg) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.observeValue" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] as [Any?]) { response in + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -4004,111 +4665,133 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateUIViewWKWebView { #if !os(macOS) - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView + func pigeonDefaultConstructor( + pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration + ) throws -> WKWebView #endif #if !os(macOS) - /// The object that contains the configuration details for the web view. - func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> WKWebViewConfiguration + /// The object that contains the configuration details for the web view. + func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + -> WKWebViewConfiguration #endif #if !os(macOS) - /// The scroll view associated with the web view. - func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> UIScrollView + /// The scroll view associated with the web view. + func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + -> UIScrollView #endif #if !os(macOS) - /// The object you use to integrate custom user interface elements, such as - /// contextual menus or panels, into web view interactions. - func setUIDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws + /// The object you use to integrate custom user interface elements, such as + /// contextual menus or panels, into web view interactions. + func setUIDelegate( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws #endif #if !os(macOS) - /// The object you use to manage navigation behavior for the web view. - func setNavigationDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws + /// The object you use to manage navigation behavior for the web view. + func setNavigationDelegate( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate + ) throws #endif #if !os(macOS) - /// The URL for the current webpage. - func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The URL for the current webpage. + func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// An estimate of what fraction of the current navigation has been loaded. - func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Double + /// An estimate of what fraction of the current navigation has been loaded. + func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + -> Double #endif #if !os(macOS) - /// Loads the web content that the specified URL request object references and - /// navigates to that content. - func load(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws + /// Loads the web content that the specified URL request object references and + /// navigates to that content. + func load( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) + throws #endif #if !os(macOS) - /// Loads the contents of the specified HTML string and navigates to it. - func loadHtmlString(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws + /// Loads the contents of the specified HTML string and navigates to it. + func loadHtmlString( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, + baseUrl: String?) throws #endif #if !os(macOS) - /// Loads the web content from the specified file and navigates to it. - func loadFileUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws + /// Loads the web content from the specified file and navigates to it. + func loadFileUrl( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, + readAccessUrl: String) throws #endif #if !os(macOS) - /// Convenience method to load a Flutter asset. - func loadFlutterAsset(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws + /// Convenience method to load a Flutter asset. + func loadFlutterAsset( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws #endif #if !os(macOS) - /// A Boolean value that indicates whether there is a valid back item in the - /// back-forward list. - func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid back item in the + /// back-forward list. + func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(macOS) - /// A Boolean value that indicates whether there is a valid forward item in - /// the back-forward list. - func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid forward item in + /// the back-forward list. + func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(macOS) - /// Navigates to the back item in the back-forward list. - func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the back item in the back-forward list. + func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// Navigates to the forward item in the back-forward list. - func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the forward item in the back-forward list. + func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// Reloads the current webpage. - func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Reloads the current webpage. + func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// The page title. - func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The page title. + func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// A Boolean value that indicates whether horizontal swipe gestures trigger - /// backward and forward page navigation. - func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// A Boolean value that indicates whether horizontal swipe gestures trigger + /// backward and forward page navigation. + func setAllowsBackForwardNavigationGestures( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif #if !os(macOS) - /// The custom user agent string. - func setCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws + /// The custom user agent string. + func setCustomUserAgent( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws #endif #if !os(macOS) - /// Evaluates the specified JavaScript string. - func evaluateJavaScript(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) + /// Evaluates the specified JavaScript string. + func evaluateJavaScript( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, + completion: @escaping (Result) -> Void) #endif #if !os(macOS) - /// A Boolean value that indicates whether you can inspect the view with - /// Safari Web Inspector. - func setInspectable(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws + /// A Boolean value that indicates whether you can inspect the view with + /// Safari Web Inspector. + func setInspectable( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws #endif #if !os(macOS) - /// The custom user agent string. - func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The custom user agent string. + func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + -> String? #endif #if !os(macOS) - /// Whether to allow previews for link destinations and detected data such as - /// addresses and phone numbers. - /// - /// Defaults to true. - func setAllowsLinkPreview(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif } protocol PigeonApiProtocolUIViewWKWebView { } -final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { +final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIViewWKWebView ///An implementation of [UIView] used to access callback methods @@ -4121,567 +4804,673 @@ final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiWKWebView(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIViewWKWebView) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateUIViewWKWebView + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewWKWebView?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewWKWebView? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let initialConfigurationArg = args[1] as! WKWebViewConfiguration - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: initialConfigurationArg), -withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + let initialConfigurationArg = args[1] as! WKWebViewConfiguration + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, initialConfiguration: initialConfigurationArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let configurationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.configuration", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - configurationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let configurationChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.configuration", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + configurationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.configuration( + pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + configurationChannel.setMessageHandler(nil) } - } else { - configurationChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let scrollViewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.scrollView", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - scrollViewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let scrollViewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.scrollView", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + scrollViewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + scrollViewChannel.setMessageHandler(nil) } - } else { - scrollViewChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setUIDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setUIDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setUIDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKUIDelegate - do { - try api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setUIDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setUIDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setUIDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKUIDelegate + do { + try api.pigeonDelegate.setUIDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setUIDelegateChannel.setMessageHandler(nil) } - } else { - setUIDelegateChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setNavigationDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setNavigationDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setNavigationDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKNavigationDelegate - do { - try api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setNavigationDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setNavigationDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setNavigationDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKNavigationDelegate + do { + try api.pigeonDelegate.setNavigationDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setNavigationDelegateChannel.setMessageHandler(nil) } - } else { - setNavigationDelegateChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getUrl", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getUrlChannel.setMessageHandler(nil) } - } else { - getUrlChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let getEstimatedProgressChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getEstimatedProgress", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getEstimatedProgressChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getEstimatedProgressChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getEstimatedProgress", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEstimatedProgressChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getEstimatedProgress( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getEstimatedProgressChannel.setMessageHandler(nil) } - } else { - getEstimatedProgressChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let loadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.load", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let requestArg = args[1] as! URLRequestWrapper - do { - try api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.load", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let requestArg = args[1] as! URLRequestWrapper + do { + try api.pigeonDelegate.load( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadChannel.setMessageHandler(nil) } - } else { - loadChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let loadHtmlStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadHtmlString", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadHtmlStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let stringArg = args[1] as! String - let baseUrlArg: String? = nilOrValue(args[2]) - do { - try api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, baseUrl: baseUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadHtmlStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadHtmlString", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadHtmlStringChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let stringArg = args[1] as! String + let baseUrlArg: String? = nilOrValue(args[2]) + do { + try api.pigeonDelegate.loadHtmlString( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, + baseUrl: baseUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadHtmlStringChannel.setMessageHandler(nil) } - } else { - loadHtmlStringChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let loadFileUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFileUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFileUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let urlArg = args[1] as! String - let readAccessUrlArg = args[2] as! String - do { - try api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, readAccessUrl: readAccessUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadFileUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFileUrl", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFileUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let urlArg = args[1] as! String + let readAccessUrlArg = args[2] as! String + do { + try api.pigeonDelegate.loadFileUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, + readAccessUrl: readAccessUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadFileUrlChannel.setMessageHandler(nil) } - } else { - loadFileUrlChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let loadFlutterAssetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFlutterAsset", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFlutterAssetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let keyArg = args[1] as! String - do { - try api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadFlutterAssetChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFlutterAsset", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFlutterAssetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let keyArg = args[1] as! String + do { + try api.pigeonDelegate.loadFlutterAsset( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadFlutterAssetChannel.setMessageHandler(nil) } - } else { - loadFlutterAssetChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let canGoBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoBack", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let canGoBackChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoBack", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoBack( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + canGoBackChannel.setMessageHandler(nil) } - } else { - canGoBackChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let canGoForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoForward", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let canGoForwardChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoForward", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoForward( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + canGoForwardChannel.setMessageHandler(nil) } - } else { - canGoForwardChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let goBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goBack", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let goBackChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goBack", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + goBackChannel.setMessageHandler(nil) } - } else { - goBackChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let goForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goForward", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let goForwardChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goForward", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + goForwardChannel.setMessageHandler(nil) } - } else { - goForwardChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.reload", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - reloadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let reloadChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.reload", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + reloadChannel.setMessageHandler(nil) } - } else { - reloadChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let getTitleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getTitle", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getTitleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getTitleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getTitle", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getTitleChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getTitle( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getTitleChannel.setMessageHandler(nil) } - } else { - getTitleChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsBackForwardNavigationGestures", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsBackForwardNavigationGestures", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsBackForwardNavigationGestures( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) } - } else { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let userAgentArg: String? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setCustomUserAgentChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setCustomUserAgent", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let userAgentArg: String? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setCustomUserAgent( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setCustomUserAgentChannel.setMessageHandler(nil) } - } else { - setCustomUserAgentChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let evaluateJavaScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.evaluateJavaScript", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - evaluateJavaScriptChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let javaScriptStringArg = args[1] as! String - api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + let evaluateJavaScriptChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.evaluateJavaScript", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + evaluateJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let javaScriptStringArg = args[1] as! String + api.pigeonDelegate.evaluateJavaScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg + ) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } } } + } else { + evaluateJavaScriptChannel.setMessageHandler(nil) } - } else { - evaluateJavaScriptChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setInspectableChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setInspectable", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setInspectableChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let inspectableArg = args[1] as! Bool - do { - try api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setInspectableChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setInspectable", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setInspectableChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let inspectableArg = args[1] as! Bool + do { + try api.pigeonDelegate.setInspectable( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setInspectableChannel.setMessageHandler(nil) } - } else { - setInspectableChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let getCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getCustomUserAgentChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getCustomUserAgent", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getCustomUserAgent( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) - } #endif } #if !os(macOS) - ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: WKWebView, 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.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(())) + } } } } - } #endif } protocol PigeonApiDelegateNSViewWKWebView { #if !os(iOS) - func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView + func pigeonDefaultConstructor( + pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration + ) throws -> WKWebView #endif #if !os(iOS) - /// The object that contains the configuration details for the web view. - func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> WKWebViewConfiguration + /// The object that contains the configuration details for the web view. + func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + -> WKWebViewConfiguration #endif #if !os(iOS) - /// The object you use to integrate custom user interface elements, such as - /// contextual menus or panels, into web view interactions. - func setUIDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws + /// The object you use to integrate custom user interface elements, such as + /// contextual menus or panels, into web view interactions. + func setUIDelegate( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws #endif #if !os(iOS) - /// The object you use to manage navigation behavior for the web view. - func setNavigationDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws + /// The object you use to manage navigation behavior for the web view. + func setNavigationDelegate( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate + ) throws #endif #if !os(iOS) - /// The URL for the current webpage. - func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The URL for the current webpage. + func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// An estimate of what fraction of the current navigation has been loaded. - func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Double + /// An estimate of what fraction of the current navigation has been loaded. + func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + -> Double #endif #if !os(iOS) - /// Loads the web content that the specified URL request object references and - /// navigates to that content. - func load(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws + /// Loads the web content that the specified URL request object references and + /// navigates to that content. + func load( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) + throws #endif #if !os(iOS) - /// Loads the contents of the specified HTML string and navigates to it. - func loadHtmlString(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws + /// Loads the contents of the specified HTML string and navigates to it. + func loadHtmlString( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, + baseUrl: String?) throws #endif #if !os(iOS) - /// Loads the web content from the specified file and navigates to it. - func loadFileUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws + /// Loads the web content from the specified file and navigates to it. + func loadFileUrl( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, + readAccessUrl: String) throws #endif #if !os(iOS) - /// Convenience method to load a Flutter asset. - func loadFlutterAsset(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws + /// Convenience method to load a Flutter asset. + func loadFlutterAsset( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws #endif #if !os(iOS) - /// A Boolean value that indicates whether there is a valid back item in the - /// back-forward list. - func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid back item in the + /// back-forward list. + func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(iOS) - /// A Boolean value that indicates whether there is a valid forward item in - /// the back-forward list. - func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid forward item in + /// the back-forward list. + func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(iOS) - /// Navigates to the back item in the back-forward list. - func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the back item in the back-forward list. + func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// Navigates to the forward item in the back-forward list. - func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the forward item in the back-forward list. + func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// Reloads the current webpage. - func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Reloads the current webpage. + func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// The page title. - func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The page title. + func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// A Boolean value that indicates whether horizontal swipe gestures trigger - /// backward and forward page navigation. - func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// A Boolean value that indicates whether horizontal swipe gestures trigger + /// backward and forward page navigation. + func setAllowsBackForwardNavigationGestures( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif #if !os(iOS) - /// The custom user agent string. - func setCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws + /// The custom user agent string. + func setCustomUserAgent( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws #endif #if !os(iOS) - /// Evaluates the specified JavaScript string. - func evaluateJavaScript(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) + /// Evaluates the specified JavaScript string. + func evaluateJavaScript( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, + completion: @escaping (Result) -> Void) #endif #if !os(iOS) - /// A Boolean value that indicates whether you can inspect the view with - /// Safari Web Inspector. - func setInspectable(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws + /// A Boolean value that indicates whether you can inspect the view with + /// Safari Web Inspector. + func setInspectable( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws #endif #if !os(iOS) - /// The custom user agent string. - func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The custom user agent string. + func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + -> String? #endif #if !os(iOS) - /// Whether to allow previews for link destinations and detected data such as - /// addresses and phone numbers. - /// - /// Defaults to true. - func setAllowsLinkPreview(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif } protocol PigeonApiProtocolNSViewWKWebView { } -final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { +final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSViewWKWebView ///An implementation of [NSObject] used to access callback methods @@ -4694,444 +5483,525 @@ final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiWKWebView(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSViewWKWebView) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateNSViewWKWebView + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSViewWKWebView?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSViewWKWebView? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(iOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let initialConfigurationArg = args[1] as! WKWebViewConfiguration - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: initialConfigurationArg), -withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + let initialConfigurationArg = args[1] as! WKWebViewConfiguration + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, initialConfiguration: initialConfigurationArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let configurationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.configuration", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - configurationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let configurationChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.configuration", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + configurationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.configuration( + pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + configurationChannel.setMessageHandler(nil) } - } else { - configurationChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setUIDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setUIDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setUIDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKUIDelegate - do { - try api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setUIDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setUIDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setUIDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKUIDelegate + do { + try api.pigeonDelegate.setUIDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setUIDelegateChannel.setMessageHandler(nil) } - } else { - setUIDelegateChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setNavigationDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setNavigationDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setNavigationDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKNavigationDelegate - do { - try api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setNavigationDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setNavigationDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setNavigationDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKNavigationDelegate + do { + try api.pigeonDelegate.setNavigationDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setNavigationDelegateChannel.setMessageHandler(nil) } - } else { - setNavigationDelegateChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getUrl", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getUrlChannel.setMessageHandler(nil) } - } else { - getUrlChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let getEstimatedProgressChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getEstimatedProgress", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getEstimatedProgressChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getEstimatedProgressChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getEstimatedProgress", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEstimatedProgressChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getEstimatedProgress( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getEstimatedProgressChannel.setMessageHandler(nil) } - } else { - getEstimatedProgressChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let loadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.load", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let requestArg = args[1] as! URLRequestWrapper - do { - try api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.load", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let requestArg = args[1] as! URLRequestWrapper + do { + try api.pigeonDelegate.load( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadChannel.setMessageHandler(nil) } - } else { - loadChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let loadHtmlStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadHtmlString", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadHtmlStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let stringArg = args[1] as! String - let baseUrlArg: String? = nilOrValue(args[2]) - do { - try api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, baseUrl: baseUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadHtmlStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadHtmlString", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadHtmlStringChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let stringArg = args[1] as! String + let baseUrlArg: String? = nilOrValue(args[2]) + do { + try api.pigeonDelegate.loadHtmlString( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, + baseUrl: baseUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadHtmlStringChannel.setMessageHandler(nil) } - } else { - loadHtmlStringChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let loadFileUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFileUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFileUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let urlArg = args[1] as! String - let readAccessUrlArg = args[2] as! String - do { - try api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, readAccessUrl: readAccessUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadFileUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFileUrl", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFileUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let urlArg = args[1] as! String + let readAccessUrlArg = args[2] as! String + do { + try api.pigeonDelegate.loadFileUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, + readAccessUrl: readAccessUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadFileUrlChannel.setMessageHandler(nil) } - } else { - loadFileUrlChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let loadFlutterAssetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFlutterAsset", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFlutterAssetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let keyArg = args[1] as! String - do { - try api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadFlutterAssetChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFlutterAsset", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFlutterAssetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let keyArg = args[1] as! String + do { + try api.pigeonDelegate.loadFlutterAsset( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadFlutterAssetChannel.setMessageHandler(nil) } - } else { - loadFlutterAssetChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let canGoBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoBack", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let canGoBackChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoBack", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoBack( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + canGoBackChannel.setMessageHandler(nil) } - } else { - canGoBackChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let canGoForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoForward", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let canGoForwardChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoForward", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoForward( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + canGoForwardChannel.setMessageHandler(nil) } - } else { - canGoForwardChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let goBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goBack", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let goBackChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goBack", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + goBackChannel.setMessageHandler(nil) } - } else { - goBackChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let goForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goForward", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let goForwardChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goForward", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + goForwardChannel.setMessageHandler(nil) } - } else { - goForwardChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.reload", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - reloadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let reloadChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.reload", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + reloadChannel.setMessageHandler(nil) } - } else { - reloadChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let getTitleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getTitle", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getTitleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getTitleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getTitle", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getTitleChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getTitle( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getTitleChannel.setMessageHandler(nil) } - } else { - getTitleChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsBackForwardNavigationGestures", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsBackForwardNavigationGestures", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsBackForwardNavigationGestures( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) } - } else { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let userAgentArg: String? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setCustomUserAgentChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setCustomUserAgent", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let userAgentArg: String? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setCustomUserAgent( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setCustomUserAgentChannel.setMessageHandler(nil) } - } else { - setCustomUserAgentChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let evaluateJavaScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.evaluateJavaScript", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - evaluateJavaScriptChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let javaScriptStringArg = args[1] as! String - api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + let evaluateJavaScriptChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.evaluateJavaScript", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + evaluateJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let javaScriptStringArg = args[1] as! String + api.pigeonDelegate.evaluateJavaScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg + ) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } } } + } else { + evaluateJavaScriptChannel.setMessageHandler(nil) } - } else { - evaluateJavaScriptChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setInspectableChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setInspectable", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setInspectableChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let inspectableArg = args[1] as! Bool - do { - try api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setInspectableChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setInspectable", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setInspectableChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let inspectableArg = args[1] as! Bool + do { + try api.pigeonDelegate.setInspectable( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setInspectableChannel.setMessageHandler(nil) } - } else { - setInspectableChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let getCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getCustomUserAgentChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getCustomUserAgent", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getCustomUserAgent( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) - } #endif } #if !os(iOS) - ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: WKWebView, 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.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(())) + } } } } - } #endif } open class PigeonApiDelegateWKWebView { @@ -5140,7 +6010,7 @@ open class PigeonApiDelegateWKWebView { protocol PigeonApiProtocolWKWebView { } -final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { +final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebView ///An implementation of [NSObject] used to access callback methods @@ -5148,26 +6018,32 @@ final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebView) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebView) + { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKWebView, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5191,19 +6067,35 @@ protocol PigeonApiDelegateWKUIDelegate { protocol PigeonApiProtocolWKUIDelegate { /// Creates a new web view. - func onCreateWebView(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, configuration configurationArg: WKWebViewConfiguration, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) + func onCreateWebView( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + configuration configurationArg: WKWebViewConfiguration, + navigationAction navigationActionArg: WKNavigationAction, + completion: @escaping (Result) -> Void) /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. - func requestMediaCapturePermission(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, completion: @escaping (Result) -> Void) + func requestMediaCapturePermission( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, + completion: @escaping (Result) -> Void) /// Displays a JavaScript alert panel. - func runJavaScriptAlertPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) + func runJavaScriptAlertPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + message messageArg: String, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void) /// Displays a JavaScript confirm panel. - func runJavaScriptConfirmPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) + func runJavaScriptConfirmPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + message messageArg: String, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void) /// Displays a JavaScript text input panel. - func runJavaScriptTextInputPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) + func runJavaScriptTextInputPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void) } -final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { +final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUIDelegate ///An implementation of [NSObject] used to access callback methods @@ -5211,25 +6103,32 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUIDelegate) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUIDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUIDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUIDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -5241,25 +6140,34 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKUIDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKUIDelegate, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKUIDelegate, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + 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. - func onCreateWebView(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, configuration configurationArg: WKWebViewConfiguration, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) { + func onCreateWebView( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + configuration configurationArg: WKWebViewConfiguration, + navigationAction navigationActionArg: WKNavigationAction, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5270,9 +6178,13 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.onCreateWebView" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, configurationArg, navigationActionArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.onCreateWebView" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [pigeonInstanceArg, webViewArg, configurationArg, navigationActionArg] as [Any?] + ) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5290,7 +6202,11 @@ withIdentifier: pigeonIdentifierArg) /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. - func requestMediaCapturePermission(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, completion: @escaping (Result) -> Void) { + func requestMediaCapturePermission( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5301,9 +6217,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, originArg, frameArg, typeArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, originArg, frameArg, typeArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5314,7 +6233,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! PermissionDecision completion(.success(result)) @@ -5323,7 +6246,11 @@ withIdentifier: pigeonIdentifierArg) } /// Displays a JavaScript alert panel. - func runJavaScriptAlertPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { + func runJavaScriptAlertPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + message messageArg: String, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5334,9 +6261,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptAlertPanel" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptAlertPanel" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5353,7 +6283,11 @@ withIdentifier: pigeonIdentifierArg) } /// Displays a JavaScript confirm panel. - func runJavaScriptConfirmPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { + func runJavaScriptConfirmPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + message messageArg: String, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5364,9 +6298,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5377,7 +6314,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -5386,7 +6327,11 @@ withIdentifier: pigeonIdentifierArg) } /// Displays a JavaScript text input panel. - func runJavaScriptTextInputPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { + func runJavaScriptTextInputPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5397,9 +6342,13 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptTextInputPanel" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, promptArg, defaultTextArg, frameArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptTextInputPanel" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [pigeonInstanceArg, webViewArg, promptArg, defaultTextArg, frameArg] as [Any?] + ) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5420,13 +6369,15 @@ withIdentifier: pigeonIdentifierArg) protocol PigeonApiDelegateWKHTTPCookieStore { /// Sets a cookie policy that indicates whether the cookie store allows cookie /// storage. - func setCookie(pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, completion: @escaping (Result) -> Void) + func setCookie( + pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, + completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolWKHTTPCookieStore { } -final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { +final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKHTTPCookieStore ///An implementation of [NSObject] used to access callback methods @@ -5434,23 +6385,33 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKHTTPCookieStore) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKHTTPCookieStore + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKHTTPCookieStore?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKHTTPCookieStore? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setCookieChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.setCookie", binaryMessenger: binaryMessenger, codec: codec) + let setCookieChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.setCookie", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setCookieChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKHTTPCookieStore let cookieArg = args[1] as! HTTPCookie - api.pigeonDelegate.setCookie(pigeonApi: api, pigeonInstance: pigeonInstanceArg, cookie: cookieArg) { result in + api.pigeonDelegate.setCookie( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, cookie: cookieArg + ) { result in switch result { case .success: reply(wrapResult(nil)) @@ -5465,21 +6426,26 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } ///Creates a Dart instance of WKHTTPCookieStore and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKHTTPCookieStore, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKHTTPCookieStore, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5499,22 +6465,27 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } protocol PigeonApiDelegateUIScrollViewDelegate { #if !os(macOS) - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws + -> UIScrollViewDelegate #endif } protocol PigeonApiProtocolUIScrollViewDelegate { #if !os(macOS) - /// Tells the delegate when the user scrolls the content view within the - /// scroll view. - /// - /// Note that this is a convenient method that includes the `contentOffset` of - /// the `scrollView`. - func scrollViewDidScroll(pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, completion: @escaping (Result) -> Void) #endif + /// Tells the delegate when the user scrolls the content view within the + /// scroll view. + /// + /// Note that this is a convenient method that includes the `contentOffset` of + /// the `scrollView`. + func scrollViewDidScroll( + pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, + scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, + completion: @escaping (Result) -> Void) + #endif } -final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate { +final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIScrollViewDelegate ///An implementation of [NSObject] used to access callback methods @@ -5522,55 +6493,112 @@ final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollViewDelegate) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateUIScrollViewDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollViewDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollViewDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } #endif } #if !os(macOS) - ///Creates a Dart instance of UIScrollViewDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: UIScrollViewDelegate, 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) + ///Creates a Dart instance of UIScrollViewDelegate and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: UIScrollViewDelegate, + 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.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(())) + } + } + } + } + #endif + #if !os(macOS) + /// Tells the delegate when the user scrolls the content view within the + /// scroll view. + /// + /// Note that this is a convenient method that includes the `contentOffset` of + /// the `scrollView`. + func scrollViewDidScroll( + pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, + scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, + completion: @escaping (Result) -> Void + ) { + if pigeonRegistrar.ignoreCallsToDart { + completion( + .failure( + PigeonError( + code: "ignore-calls-error", + message: "Calls to Dart are being ignored.", details: ""))) + return + } 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 + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.scrollViewDidScroll" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, scrollViewArg, xArg, yArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5585,55 +6613,22 @@ withIdentifier: pigeonIdentifierArg) } } } - } - #endif - #if !os(macOS) - /// Tells the delegate when the user scrolls the content view within the - /// scroll view. - /// - /// Note that this is a convenient method that includes the `contentOffset` of - /// the `scrollView`. - func scrollViewDidScroll(pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, completion: @escaping (Result) -> Void) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.scrollViewDidScroll" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, scrollViewArg, xArg, yArg] 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(())) - } - } - } #endif } protocol PigeonApiDelegateURLCredential { /// Creates a URL credential instance for internet password authentication /// with a given user name and password, using a given persistence setting. - func withUser(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence) throws -> URLCredential + func withUser( + pigeonApi: PigeonApiURLCredential, user: String, password: String, + persistence: UrlCredentialPersistence + ) throws -> URLCredential } protocol PigeonApiProtocolURLCredential { } -final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { +final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLCredential ///An implementation of [NSObject] used to access callback methods @@ -5641,17 +6636,24 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLCredential) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLCredential + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLCredential?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLCredential? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let withUserChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUser", binaryMessenger: binaryMessenger, codec: codec) + let withUserChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUser", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { withUserChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -5661,8 +6663,9 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { let persistenceArg = args[3] as! UrlCredentialPersistence do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.withUser(pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.withUser( + pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -5674,21 +6677,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of URLCredential and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLCredential, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLCredential, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5708,21 +6716,27 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateURLProtectionSpace { /// The receiver’s host. - func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String + func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws + -> String /// The receiver’s port. - func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> Int64 + func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws + -> Int64 /// The receiver’s authentication realm. - func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? + func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws + -> String? /// The authentication method used by the receiver. - func authenticationMethod(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? + func authenticationMethod( + pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace + ) throws -> String? /// A representation of the server’s SSL transaction state. - func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> SecTrustWrapper? + func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) + throws -> SecTrustWrapper? } protocol PigeonApiProtocolURLProtectionSpace { } -final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { +final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLProtectionSpace ///An implementation of [NSObject] used to access callback methods @@ -5730,23 +6744,32 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLProtectionSpace) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateURLProtectionSpace + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getServerTrustChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", binaryMessenger: binaryMessenger, codec: codec) + let getServerTrustChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getServerTrustChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLProtectionSpace do { - let result = try api.pigeonDelegate.getServerTrust(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getServerTrust( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -5758,26 +6781,34 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } ///Creates a Dart instance of URLProtectionSpace and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLProtectionSpace, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLProtectionSpace, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -5796,13 +6827,15 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } protocol PigeonApiDelegateURLAuthenticationChallenge { /// The receiver’s protection space. - func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace + func getProtectionSpace( + pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge + ) throws -> URLProtectionSpace } protocol PigeonApiProtocolURLAuthenticationChallenge { } -final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticationChallenge { +final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticationChallenge { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLAuthenticationChallenge ///An implementation of [NSObject] used to access callback methods @@ -5810,23 +6843,33 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLAuthenticationChallenge) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateURLAuthenticationChallenge + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLAuthenticationChallenge?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLAuthenticationChallenge? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getProtectionSpaceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.getProtectionSpace", binaryMessenger: binaryMessenger, codec: codec) + let getProtectionSpaceChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.getProtectionSpace", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getProtectionSpaceChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLAuthenticationChallenge do { - let result = try api.pigeonDelegate.getProtectionSpace(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getProtectionSpace( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -5838,21 +6881,27 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat } ///Creates a Dart instance of URLAuthenticationChallenge and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLAuthenticationChallenge, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLAuthenticationChallenge, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5878,7 +6927,7 @@ protocol PigeonApiDelegateURL { protocol PigeonApiProtocolURL { } -final class PigeonApiURL: PigeonApiProtocolURL { +final class PigeonApiURL: PigeonApiProtocolURL { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURL ///An implementation of [NSObject] used to access callback methods @@ -5894,15 +6943,19 @@ final class PigeonApiURL: PigeonApiProtocolURL { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getAbsoluteStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URL.getAbsoluteString", binaryMessenger: binaryMessenger, codec: codec) + let getAbsoluteStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URL.getAbsoluteString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAbsoluteStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URL do { - let result = try api.pigeonDelegate.getAbsoluteString(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAbsoluteString( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -5914,21 +6967,26 @@ final class PigeonApiURL: PigeonApiProtocolURL { } ///Creates a Dart instance of URL and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URL, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URL, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5950,13 +7008,15 @@ 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 + func setAllowsContentJavaScript( + pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) + throws } protocol PigeonApiProtocolWKWebpagePreferences { } -final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { +final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebpagePreferences ///An implementation of [NSObject] used to access callback methods @@ -5964,25 +7024,35 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebpagePreferences) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKWebpagePreferences + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + 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) + 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) + try api.pigeonDelegate.setAllowsContentJavaScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -5991,16 +7061,21 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } else { setAllowsContentJavaScriptChannel.setMessageHandler(nil) } - } else { + } else { let setAllowsContentJavaScriptChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.setAllowsContentJavaScript", + 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 - ))) + reply( + wrapError( + FlutterError( + code: "PigeonUnsupportedOperationError", + message: + "Call to setAllowsContentJavaScript requires @available(iOS 13.0.0, macOS 10.15.0, *).", + details: nil + ))) } } else { setAllowsContentJavaScriptChannel.setMessageHandler(nil) @@ -6010,21 +7085,26 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences ///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) { + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -6044,17 +7124,20 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } protocol PigeonApiDelegateGetTrustResultResponse { /// The result code from the most recent trust evaluation. - func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType + func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) + throws -> DartSecTrustResultType /// A result code. /// /// See https://developer.apple.com/documentation/security/security-framework-result-codes?language=objc. - func resultCode(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> Int64 + func resultCode( + pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse + ) throws -> Int64 } protocol PigeonApiProtocolGetTrustResultResponse { } -final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResponse { +final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateGetTrustResultResponse ///An implementation of [NSObject] used to access callback methods @@ -6062,28 +7145,38 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateGetTrustResultResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateGetTrustResultResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of GetTrustResultResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: GetTrustResultResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: GetTrustResultResponse, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let resultArg = try! pigeonDelegate.result(pigeonApi: self, pigeonInstance: pigeonInstance) - let resultCodeArg = try! pigeonDelegate.resultCode(pigeonApi: self, pigeonInstance: pigeonInstance) + let resultCodeArg = try! pigeonDelegate.resultCode( + pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.GetTrustResultResponse.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.GetTrustResultResponse.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, resultArg, resultCodeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -6103,23 +7196,30 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp } protocol PigeonApiDelegateSecTrust { /// Evaluates trust for the specified certificate and policies. - func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) + func evaluateWithError( + pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, + completion: @escaping (Result) -> Void) /// Returns an opaque cookie containing exceptions to trust policies that will /// allow future evaluations of the current certificate to succeed. - func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> FlutterStandardTypedData? + func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws + -> FlutterStandardTypedData? /// Sets a list of exceptions that should be ignored when the certificate is /// evaluated. - func setExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData?) throws -> Bool + func setExceptions( + pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData? + ) throws -> Bool /// Returns the result code from the most recent trust evaluation. - func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> GetTrustResultResponse + func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws + -> GetTrustResultResponse /// Certificates used to evaluate trust. - func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> [SecCertificateWrapper]? + func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws + -> [SecCertificateWrapper]? } protocol PigeonApiProtocolSecTrust { } -final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { +final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateSecTrust ///An implementation of [NSObject] used to access callback methods @@ -6131,13 +7231,17 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecTrust?) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecTrust?) + { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let evaluateWithErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.evaluateWithError", binaryMessenger: binaryMessenger, codec: codec) + let evaluateWithErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.evaluateWithError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { evaluateWithErrorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6154,7 +7258,9 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { evaluateWithErrorChannel.setMessageHandler(nil) } - let copyExceptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyExceptions", binaryMessenger: binaryMessenger, codec: codec) + let copyExceptionsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyExceptions", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyExceptionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6169,14 +7275,17 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { copyExceptionsChannel.setMessageHandler(nil) } - let setExceptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.setExceptions", binaryMessenger: binaryMessenger, codec: codec) + let setExceptionsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.setExceptions", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setExceptionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let trustArg = args[0] as! SecTrustWrapper let exceptionsArg: FlutterStandardTypedData? = nilOrValue(args[1]) do { - let result = try api.pigeonDelegate.setExceptions(pigeonApi: api, trust: trustArg, exceptions: exceptionsArg) + let result = try api.pigeonDelegate.setExceptions( + pigeonApi: api, trust: trustArg, exceptions: exceptionsArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -6185,7 +7294,9 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { setExceptionsChannel.setMessageHandler(nil) } - let getTrustResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.getTrustResult", binaryMessenger: binaryMessenger, codec: codec) + let getTrustResultChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.getTrustResult", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getTrustResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6200,7 +7311,9 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { getTrustResultChannel.setMessageHandler(nil) } - let copyCertificateChainChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyCertificateChain", binaryMessenger: binaryMessenger, codec: codec) + let copyCertificateChainChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyCertificateChain", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyCertificateChainChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6218,21 +7331,26 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } ///Creates a Dart instance of SecTrust and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: SecTrustWrapper, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: SecTrustWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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.SecTrust.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.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))) @@ -6252,13 +7370,14 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } protocol PigeonApiDelegateSecCertificate { /// Returns a DER representation of a certificate given a certificate object. - func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData + func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws + -> FlutterStandardTypedData } protocol PigeonApiProtocolSecCertificate { } -final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { +final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateSecCertificate ///An implementation of [NSObject] used to access callback methods @@ -6266,17 +7385,24 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateSecCertificate) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateSecCertificate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecCertificate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecCertificate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let copyDataChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.copyData", binaryMessenger: binaryMessenger, codec: codec) + let copyDataChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.copyData", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyDataChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6294,21 +7420,26 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { } ///Creates a Dart instance of SecCertificate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: SecCertificateWrapper, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: SecCertificateWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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.SecCertificate.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.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))) 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 45871baa33e4..c6a9598d1e0a 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 @@ -8,7 +8,8 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' + show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -19,7 +20,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -28,6 +30,7 @@ List wrapResponse({Object? result, PlatformException? error, bool empty } return [error.code, error.message, error.details]; } + /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -110,9 +113,10 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> _weakInstances = - >{}; - final Map _strongInstances = {}; + final Map> + _weakInstances = >{}; + final Map _strongInstances = + {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -122,7 +126,8 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = + _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -130,42 +135,76 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); - URLRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - HTTPURLResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - URLResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKUserScript.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKNavigationAction.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKNavigationResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKFrameInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - NSError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKScriptMessage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKSecurityOrigin.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - HTTPCookie.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AuthenticationChallengeResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebsiteDataStore.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + _PigeonInternalInstanceManagerApi.setUpMessageHandlers( + instanceManager: instanceManager); + URLRequest.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + HTTPURLResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + URLResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKUserScript.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKNavigationAction.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKNavigationResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKFrameInfo.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + NSError.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKScriptMessage.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKSecurityOrigin.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + HTTPCookie.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AuthenticationChallengeResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKWebsiteDataStore.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); UIView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIScrollView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebViewConfiguration.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKUserContentController.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKPreferences.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKScriptMessageHandler.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKNavigationDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - NSObject.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIViewWKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - NSViewWKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKUIDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKHTTPCookieStore.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIScrollViewDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - URLCredential.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - URLProtectionSpace.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - URLAuthenticationChallenge.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + UIScrollView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKWebViewConfiguration.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKUserContentController.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKPreferences.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKScriptMessageHandler.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKNavigationDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + NSObject.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + UIViewWKWebView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + NSViewWKWebView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKWebView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKUIDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKHTTPCookieStore.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + UIScrollViewDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + URLCredential.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + URLProtectionSpace.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + URLAuthenticationChallenge.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); URL.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebpagePreferences.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - GetTrustResultResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - SecTrust.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - SecCertificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebpagePreferences.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + GetTrustResultResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + SecTrust.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + SecCertificate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -229,15 +268,20 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference(int identifier) { - final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference( + int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = + _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = + _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass copy = + strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = WeakReference(copy); + _weakInstances[identifier] = + WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -261,17 +305,20 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance( + PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier( + PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = WeakReference(instance); + _weakInstances[identifier] = + WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); @@ -398,29 +445,29 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } -} + const _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } +} /// The values that can be returned in a change dictionary. /// @@ -429,12 +476,15 @@ enum KeyValueObservingOptions { /// Indicates that the change dictionary should provide the new attribute /// value, if applicable. newValue, + /// Indicates that the change dictionary should contain the old attribute /// value, if applicable. oldValue, + /// If specified, a notification should be sent to the observer immediately, /// before the observer registration method even returns. initialValue, + /// Whether separate notifications should be sent to the observer before and /// after each change, instead of a single notification after the change. priorNotification, @@ -446,15 +496,19 @@ enum KeyValueObservingOptions { enum KeyValueChange { /// Indicates that the value of the observed key path was set to a new value. setting, + /// Indicates that an object has been inserted into the to-many relationship /// that is being observed. insertion, + /// Indicates that an object has been removed from the to-many relationship /// that is being observed. removal, + /// Indicates that an object has been replaced in the to-many relationship /// that is being observed. replacement, + /// The value is not recognized by the wrapper. unknown, } @@ -468,23 +522,28 @@ enum KeyValueChangeKey { /// `KeyValueChange.replacement`, the value of this key is a Set object that /// contains the indexes of the inserted, removed, or replaced objects. indexes, + /// An object that contains a value corresponding to one of the /// `KeyValueChange` enum, indicating what sort of change has occurred. kind, + /// If the value of the `KeyValueChange.kind` entry is /// `KeyValueChange.setting, and `KeyValueObservingOptions.newValue` was /// specified when the observer was registered, the value of this key is the /// new value for the attribute. newValue, + /// If the `KeyValueObservingOptions.priorNotification` option was specified /// when the observer was registered this notification is sent prior to a /// change. notificationIsPrior, + /// If the value of the `KeyValueChange.kind` entry is /// `KeyValueChange.setting`, and `KeyValueObservingOptions.old` was specified /// when the observer was registered, the value of this key is the value /// before the attribute was changed. oldValue, + /// The value is not recognized by the wrapper. unknown, } @@ -496,9 +555,11 @@ enum UserScriptInjectionTime { /// A constant to inject the script after the creation of the webpage’s /// document element, but before loading any other content. atDocumentStart, + /// A constant to inject the script after the document finishes loading, but /// before loading any other subresources. atDocumentEnd, + /// The value is not recognized by the wrapper. unknown, } @@ -509,10 +570,13 @@ enum UserScriptInjectionTime { enum AudiovisualMediaType { /// No media types require a user gesture to begin playing. none, + /// Media types that contain audio require a user gesture to begin playing. audio, + /// Media types that contain video require a user gesture to begin playing. video, + /// All media types require a user gesture to begin playing. all, } @@ -524,18 +588,25 @@ enum AudiovisualMediaType { enum WebsiteDataType { /// Cookies. cookies, + /// In-memory caches. memoryCache, + /// On-disk caches. diskCache, + /// HTML offline web app caches. offlineWebApplicationCache, + /// HTML local storage. localStorage, + /// HTML session storage. sessionStorage, + /// WebSQL databases. webSQLDatabases, + /// IndexedDB databases. indexedDBDatabases, } @@ -547,8 +618,10 @@ enum WebsiteDataType { enum NavigationActionPolicy { /// Allow the navigation to continue. allow, + /// Cancel the navigation. cancel, + /// Allow the download to proceed. download, } @@ -560,8 +633,10 @@ enum NavigationActionPolicy { enum NavigationResponsePolicy { /// Allow the navigation to continue. allow, + /// Cancel the navigation. cancel, + /// Allow the download to proceed. download, } @@ -572,37 +647,51 @@ enum NavigationResponsePolicy { enum HttpCookiePropertyKey { /// A String object containing the comment for the cookie. comment, + /// An Uri object or String object containing the comment URL for the cookie. commentUrl, + /// Aa String object stating whether the cookie should be discarded at the end /// of the session. discard, + /// An String object containing the domain for the cookie. domain, + /// An Date object or String object specifying the expiration date for the /// cookie. expires, + /// An String object containing an integer value stating how long in seconds /// the cookie should be kept, at most. maximumAge, + /// An String object containing the name of the cookie (required). name, + /// A URL or String object containing the URL that set this cookie. originUrl, + /// A String object containing the path for the cookie. path, + /// An String object containing comma-separated integer values specifying the /// ports for the cookie. port, + /// A string indicating the same-site policy for the cookie. sameSitePolicy, + /// A String object indicating that the cookie should be transmitted only over /// secure channels. secure, + /// A String object containing the value of the cookie. value, + /// A String object that specifies the version of the cookie. version, + /// The value is not recognized by the wrapper. unknown, } @@ -613,16 +702,22 @@ enum HttpCookiePropertyKey { enum NavigationType { /// A link activation. linkActivated, + /// A request to submit a form. formSubmitted, + /// A request for the frame’s next or previous item. backForward, + /// A request to reload the webpage. reload, + /// A request to resubmit a form. formResubmitted, + /// A navigation request that originates for some other reason. other, + /// The value is not recognized by the wrapper. unknown, } @@ -633,8 +728,10 @@ enum NavigationType { enum PermissionDecision { /// Deny permission for the requested resource. deny, + /// Deny permission for the requested resource. grant, + /// Prompt the user for permission for the requested resource. prompt, } @@ -645,10 +742,13 @@ enum PermissionDecision { enum MediaCaptureType { /// A media device that can capture video. camera, + /// A media device or devices that can capture audio and video. cameraAndMicrophone, + /// A media device that can capture audio. microphone, + /// The value is not recognized by the wrapper. unknown, } @@ -659,14 +759,18 @@ enum MediaCaptureType { enum UrlSessionAuthChallengeDisposition { /// Use the specified credential, which may be nil. useCredential, + /// Use the default handling for the challenge as though this delegate method /// were not implemented. performDefaultHandling, + /// Cancel the entire request. cancelAuthenticationChallenge, + /// Reject this challenge, and call the authentication delegate method again /// with the next authentication protection space. rejectProtectionSpace, + /// The value is not recognized by the wrapper. unknown, } @@ -677,10 +781,13 @@ enum UrlSessionAuthChallengeDisposition { enum UrlCredentialPersistence { /// The credential should not be stored. none, + /// The credential should be stored only for this session. forSession, + /// The credential should be stored in the keychain. permanent, + /// The credential should be stored permanently in the keychain, and in /// addition should be distributed to other devices based on the owning Apple /// ID. @@ -693,26 +800,33 @@ enum UrlCredentialPersistence { enum DartSecTrustResultType { /// The user did not specify a trust setting. unspecified, + /// The user granted permission to trust the certificate for the purposes /// designated in the specified policies. proceed, + /// The user specified that the certificate should not be trusted. deny, + /// Trust is denied, but recovery may be possible. recoverableTrustFailure, + /// Trust is denied and no simple fix is available. fatalTrustFailure, + /// A value that indicates a failure other than trust evaluation. otherError, + /// An indication of an invalid setting or result. invalid, + /// User confirmation is required before proceeding. confirm, + /// The type is not recognized by this wrapper. unknown, } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -720,49 +834,49 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is KeyValueObservingOptions) { + } else if (value is KeyValueObservingOptions) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is KeyValueChange) { + } else if (value is KeyValueChange) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is KeyValueChangeKey) { + } else if (value is KeyValueChangeKey) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is UserScriptInjectionTime) { + } else if (value is UserScriptInjectionTime) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is AudiovisualMediaType) { + } else if (value is AudiovisualMediaType) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is WebsiteDataType) { + } else if (value is WebsiteDataType) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is NavigationActionPolicy) { + } else if (value is NavigationActionPolicy) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is NavigationResponsePolicy) { + } else if (value is NavigationResponsePolicy) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is HttpCookiePropertyKey) { + } else if (value is HttpCookiePropertyKey) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is NavigationType) { + } else if (value is NavigationType) { buffer.putUint8(138); writeValue(buffer, value.index); - } else if (value is PermissionDecision) { + } else if (value is PermissionDecision) { buffer.putUint8(139); writeValue(buffer, value.index); - } else if (value is MediaCaptureType) { + } else if (value is MediaCaptureType) { buffer.putUint8(140); writeValue(buffer, value.index); - } else if (value is UrlSessionAuthChallengeDisposition) { + } else if (value is UrlSessionAuthChallengeDisposition) { buffer.putUint8(141); writeValue(buffer, value.index); - } else if (value is UrlCredentialPersistence) { + } else if (value is UrlCredentialPersistence) { buffer.putUint8(142); writeValue(buffer, value.index); - } else if (value is DartSecTrustResultType) { + } else if (value is DartSecTrustResultType) { buffer.putUint8(143); writeValue(buffer, value.index); } else { @@ -773,49 +887,51 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueObservingOptions.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChange.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChangeKey.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : UserScriptInjectionTime.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : AudiovisualMediaType.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : WebsiteDataType.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationActionPolicy.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationResponsePolicy.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : HttpCookiePropertyKey.values[value]; - case 138: + case 138: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationType.values[value]; - case 139: + case 139: final int? value = readValue(buffer) as int?; return value == null ? null : PermissionDecision.values[value]; - case 140: + case 140: final int? value = readValue(buffer) as int?; return value == null ? null : MediaCaptureType.values[value]; - case 141: + case 141: final int? value = readValue(buffer) as int?; - return value == null ? null : UrlSessionAuthChallengeDisposition.values[value]; - case 142: + return value == null + ? null + : UrlSessionAuthChallengeDisposition.values[value]; + case 142: final int? value = readValue(buffer) as int?; return value == null ? null : UrlCredentialPersistence.values[value]; - case 143: + case 143: final int? value = readValue(buffer) as int?; return value == null ? null : DartSecTrustResultType.values[value]; default: @@ -823,6 +939,7 @@ class _PigeonCodec extends StandardMessageCodec { } } } + /// A URL load request that is independent of protocol or URL scheme. /// /// See https://developer.apple.com/documentation/foundation/urlrequest. @@ -8478,4 +8595,3 @@ class SecCertificate extends NSObject { ); } } - 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 e29d4d71a3fb..4e7d186e80f5 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 @@ -25,19 +25,19 @@ 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); + : super(parent, parentInvocation); } class _FakeWKHTTPCookieStore_1 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { _FakeWKHTTPCookieStore_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_2 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [WKHTTPCookieStore]. @@ -49,35 +49,29 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i3.Future setCookie(_i2.HTTPCookie? cookie) => - (super.noSuchMethod( - Invocation.method(#setCookie, [cookie]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setCookie(_i2.HTTPCookie? cookie) => (super.noSuchMethod( + 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, []), - returnValue: _FakeWKHTTPCookieStore_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKHTTPCookieStore_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKHTTPCookieStore); @override _i3.Future addObserver( @@ -86,20 +80,18 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKWebsiteDataStore]. @@ -112,37 +104,31 @@ class MockWKWebsiteDataStore extends _i1.Mock } @override - _i2.WKHTTPCookieStore get httpCookieStore => - (super.noSuchMethod( - Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_1( - this, - Invocation.getter(#httpCookieStore), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( + Invocation.getter(#httpCookieStore), + returnValue: _FakeWKHTTPCookieStore_1( + this, + Invocation.getter(#httpCookieStore), + ), + ) as _i2.WKHTTPCookieStore); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => - (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_1( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_1( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + ) as _i2.WKHTTPCookieStore); @override _i3.Future removeDataOfTypes( @@ -150,24 +136,21 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method(#removeDataOfTypes, [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ]), - returnValue: _i3.Future.value(false), - ) - as _i3.Future); + Invocation.method(#removeDataOfTypes, [ + dataTypes, + modificationTimeInSecondsSinceEpoch, + ]), + returnValue: _i3.Future.value(false), + ) as _i3.Future); @override - _i2.WKWebsiteDataStore pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebsiteDataStore_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebsiteDataStore); + _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebsiteDataStore); @override _i3.Future addObserver( @@ -176,18 +159,16 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + 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.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart index 678af5683fe2..88df3f478fc5 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 @@ -36,86 +36,86 @@ 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); + : super(parent, parentInvocation); } class _FakeUIScrollView_1 extends _i1.SmartFake implements _i2.UIScrollView { _FakeUIScrollView_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURLRequest_2 extends _i1.SmartFake implements _i2.URLRequest { _FakeURLRequest_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKNavigationDelegate_3 extends _i1.SmartFake implements _i2.WKNavigationDelegate { _FakeWKNavigationDelegate_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKPreferences_4 extends _i1.SmartFake implements _i2.WKPreferences { _FakeWKPreferences_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKScriptMessageHandler_5 extends _i1.SmartFake implements _i2.WKScriptMessageHandler { _FakeWKScriptMessageHandler_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebView_6 extends _i1.SmartFake implements _i2.WKWebView { _FakeWKWebView_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebViewConfiguration_7 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { _FakeWKWebViewConfiguration_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeUIViewWKWebView_8 extends _i1.SmartFake implements _i2.UIViewWKWebView { _FakeUIViewWKWebView_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUserContentController_9 extends _i1.SmartFake implements _i2.WKUserContentController { _FakeWKUserContentController_9(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_10 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_10(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebpagePreferences_11 extends _i1.SmartFake implements _i2.WKWebpagePreferences { _FakeWKWebpagePreferences_11(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKHTTPCookieStore_12 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { _FakeWKHTTPCookieStore_12(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUIDelegate_13 extends _i1.SmartFake implements _i2.WKUIDelegate { _FakeWKUIDelegate_13(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakePlatformWebView_14 extends _i1.SmartFake implements _i3.PlatformWebView { _FakePlatformWebView_14(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [UIScrollView]. @@ -127,124 +127,101 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i4.Future> getContentOffset() => - (super.noSuchMethod( - Invocation.method(#getContentOffset, []), - returnValue: _i4.Future>.value([]), - ) - as _i4.Future>); + _i4.Future> getContentOffset() => (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _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) => (super.noSuchMethod( - Invocation.method(#setContentOffset, [x, y]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setContentOffset, [x, y]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future setDelegate(_i2.UIScrollViewDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setDelegate, [delegate]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + _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); + _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); + _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); + _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); + 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, []), - returnValue: _FakeUIScrollView_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.UIScrollView); + _i2.UIScrollView pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollView_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.UIScrollView); @override - _i4.Future setBackgroundColor(int? value) => - (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [value]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setBackgroundColor(int? value) => (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setOpaque(bool? opaque) => (super.noSuchMethod( + Invocation.method(#setOpaque, [opaque]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future addObserver( @@ -253,20 +230,18 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [URLRequest]. @@ -278,85 +253,69 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i4.Future getUrl() => - (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future getUrl() => (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future setHttpMethod(String? method) => - (super.noSuchMethod( - Invocation.method(#setHttpMethod, [method]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setHttpMethod(String? method) => (super.noSuchMethod( + Invocation.method(#setHttpMethod, [method]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future getHttpMethod() => - (super.noSuchMethod( - Invocation.method(#getHttpMethod, []), - returnValue: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future getHttpMethod() => (super.noSuchMethod( + Invocation.method(#getHttpMethod, []), + returnValue: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future setHttpBody(_i5.Uint8List? body) => - (super.noSuchMethod( - Invocation.method(#setHttpBody, [body]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setHttpBody(_i5.Uint8List? body) => (super.noSuchMethod( + 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, []), - returnValue: _i4.Future<_i5.Uint8List?>.value(), - ) - as _i4.Future<_i5.Uint8List?>); + _i4.Future<_i5.Uint8List?> getHttpBody() => (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setAllHttpHeaderFields, [fields]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method(#getAllHttpHeaderFields, []), - returnValue: _i4.Future?>.value(), - ) - as _i4.Future?>); + Invocation.method(#getAllHttpHeaderFields, []), + returnValue: _i4.Future?>.value(), + ) as _i4.Future?>); @override - _i2.URLRequest pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeURLRequest_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.URLRequest); + _i2.URLRequest pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLRequest_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.URLRequest); @override _i4.Future addObserver( @@ -365,20 +324,18 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WKNavigationDelegate]. @@ -395,92 +352,79 @@ class MockWKNavigationDelegate extends _i1.Mock _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, - )); + ) 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, - )); + ) 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> 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>.value([]), - ) - as _i4.Future> Function( - _i2.WKNavigationDelegate, - _i2.WKWebView, - _i2.URLAuthenticationChallenge, - )); - - @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); - - @override - _i2.WKNavigationDelegate pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKNavigationDelegate_3( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKNavigationDelegate); + ) get didReceiveAuthenticationChallenge => (super.noSuchMethod( + Invocation.getter(#didReceiveAuthenticationChallenge), + returnValue: ( + _i2.WKNavigationDelegate pigeon_instance, + _i2.WKWebView webView, + _i2.URLAuthenticationChallenge challenge, + ) => + _i4.Future>.value([]), + ) as _i4.Future> Function( + _i2.WKNavigationDelegate, + _i2.WKWebView, + _i2.URLAuthenticationChallenge, + )); + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i2.WKNavigationDelegate pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKNavigationDelegate_3( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKNavigationDelegate); @override _i4.Future addObserver( @@ -489,20 +433,18 @@ class MockWKNavigationDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WKPreferences]. @@ -514,35 +456,29 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i4.Future setJavaScriptEnabled(bool? enabled) => - (super.noSuchMethod( - Invocation.method(#setJavaScriptEnabled, [enabled]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod( + 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( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKPreferences); + _i2.WKPreferences pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKPreferences_4( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKPreferences); @override _i4.Future addObserver( @@ -551,20 +487,18 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WKScriptMessageHandler]. @@ -581,44 +515,36 @@ class MockWKScriptMessageHandler extends _i1.Mock _i2.WKScriptMessageHandler, _i2.WKUserContentController, _i2.WKScriptMessage, - ) - get didReceiveScriptMessage => - (super.noSuchMethod( - Invocation.getter(#didReceiveScriptMessage), - returnValue: - ( - _i2.WKScriptMessageHandler pigeon_instance, - _i2.WKUserContentController controller, - _i2.WKScriptMessage message, - ) {}, - ) - as void Function( - _i2.WKScriptMessageHandler, - _i2.WKUserContentController, - _i2.WKScriptMessage, - )); - - @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); - - @override - _i2.WKScriptMessageHandler pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKScriptMessageHandler_5( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKScriptMessageHandler); + ) get didReceiveScriptMessage => (super.noSuchMethod( + Invocation.getter(#didReceiveScriptMessage), + returnValue: ( + _i2.WKScriptMessageHandler pigeon_instance, + _i2.WKUserContentController controller, + _i2.WKScriptMessage message, + ) {}, + ) as void Function( + _i2.WKScriptMessageHandler, + _i2.WKUserContentController, + _i2.WKScriptMessage, + )); + + @override + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i2.WKScriptMessageHandler pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKScriptMessageHandler_5( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKScriptMessageHandler); @override _i4.Future addObserver( @@ -627,20 +553,18 @@ class MockWKScriptMessageHandler extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WKWebView]. @@ -652,26 +576,22 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i2.WKWebView pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebView_6( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebView); + _i2.WKWebView pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebView_6( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebView); @override _i4.Future addObserver( @@ -680,20 +600,18 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [UIViewWKWebView]. @@ -705,261 +623,211 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { } @override - _i2.WKWebViewConfiguration get configuration => - (super.noSuchMethod( - Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_7( - this, - Invocation.getter(#configuration), - ), - ) - as _i2.WKWebViewConfiguration); + _i2.WKWebViewConfiguration get configuration => (super.noSuchMethod( + Invocation.getter(#configuration), + returnValue: _FakeWKWebViewConfiguration_7( + this, + Invocation.getter(#configuration), + ), + ) as _i2.WKWebViewConfiguration); @override - _i2.UIScrollView get scrollView => - (super.noSuchMethod( - Invocation.getter(#scrollView), - returnValue: _FakeUIScrollView_1( - this, - Invocation.getter(#scrollView), - ), - ) - as _i2.UIScrollView); + _i2.UIScrollView get scrollView => (super.noSuchMethod( + Invocation.getter(#scrollView), + returnValue: _FakeUIScrollView_1( + this, + Invocation.getter(#scrollView), + ), + ) as _i2.UIScrollView); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i2.WKWebViewConfiguration pigeonVar_configuration() => - (super.noSuchMethod( - Invocation.method(#pigeonVar_configuration, []), - returnValue: _FakeWKWebViewConfiguration_7( - this, - Invocation.method(#pigeonVar_configuration, []), - ), - ) - as _i2.WKWebViewConfiguration); + _i2.WKWebViewConfiguration pigeonVar_configuration() => (super.noSuchMethod( + Invocation.method(#pigeonVar_configuration, []), + returnValue: _FakeWKWebViewConfiguration_7( + this, + Invocation.method(#pigeonVar_configuration, []), + ), + ) as _i2.WKWebViewConfiguration); @override - _i2.UIScrollView pigeonVar_scrollView() => - (super.noSuchMethod( - Invocation.method(#pigeonVar_scrollView, []), - returnValue: _FakeUIScrollView_1( - this, - Invocation.method(#pigeonVar_scrollView, []), - ), - ) - as _i2.UIScrollView); + _i2.UIScrollView pigeonVar_scrollView() => (super.noSuchMethod( + Invocation.method(#pigeonVar_scrollView, []), + returnValue: _FakeUIScrollView_1( + this, + Invocation.method(#pigeonVar_scrollView, []), + ), + ) as _i2.UIScrollView); @override _i4.Future setUIDelegate(_i2.WKUIDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setUIDelegate, [delegate]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setUIDelegate, [delegate]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future setNavigationDelegate(_i2.WKNavigationDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setNavigationDelegate, [delegate]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setNavigationDelegate, [delegate]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future getUrl() => - (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future getUrl() => (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future getEstimatedProgress() => - (super.noSuchMethod( - Invocation.method(#getEstimatedProgress, []), - returnValue: _i4.Future.value(0.0), - ) - as _i4.Future); + _i4.Future getEstimatedProgress() => (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future load(_i2.URLRequest? request) => (super.noSuchMethod( + Invocation.method(#load, [request]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future loadHtmlString(String? string, String? baseUrl) => (super.noSuchMethod( - Invocation.method(#loadHtmlString, [string, baseUrl]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#loadHtmlString, [string, baseUrl]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future loadFileUrl(String? url, String? readAccessUrl) => (super.noSuchMethod( - Invocation.method(#loadFileUrl, [url, readAccessUrl]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future loadFlutterAsset(String? key) => (super.noSuchMethod( + Invocation.method(#loadFlutterAsset, [key]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future canGoBack() => - (super.noSuchMethod( - Invocation.method(#canGoBack, []), - returnValue: _i4.Future.value(false), - ) - as _i4.Future); + _i4.Future canGoBack() => (super.noSuchMethod( + Invocation.method(#canGoBack, []), + returnValue: _i4.Future.value(false), + ) as _i4.Future); @override - _i4.Future canGoForward() => - (super.noSuchMethod( - Invocation.method(#canGoForward, []), - returnValue: _i4.Future.value(false), - ) - as _i4.Future); + _i4.Future canGoForward() => (super.noSuchMethod( + Invocation.method(#canGoForward, []), + returnValue: _i4.Future.value(false), + ) as _i4.Future); @override - _i4.Future goBack() => - (super.noSuchMethod( - Invocation.method(#goBack, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future goBack() => (super.noSuchMethod( + Invocation.method(#goBack, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future goForward() => - (super.noSuchMethod( - Invocation.method(#goForward, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future goForward() => (super.noSuchMethod( + Invocation.method(#goForward, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future reload() => - (super.noSuchMethod( - Invocation.method(#reload, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future reload() => (super.noSuchMethod( + Invocation.method(#reload, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future getTitle() => - (super.noSuchMethod( - Invocation.method(#getTitle, []), - returnValue: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future getTitle() => (super.noSuchMethod( + Invocation.method(#getTitle, []), + returnValue: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsBackForwardNavigationGestures, [allow]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod( + Invocation.method(#setCustomUserAgent, [userAgent]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( - Invocation.method(#evaluateJavaScript, [javaScriptString]), - returnValue: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#evaluateJavaScript, [javaScriptString]), + returnValue: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future setInspectable(bool? inspectable) => - (super.noSuchMethod( - Invocation.method(#setInspectable, [inspectable]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setInspectable(bool? inspectable) => (super.noSuchMethod( + Invocation.method(#setInspectable, [inspectable]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future getCustomUserAgent() => - (super.noSuchMethod( - Invocation.method(#getCustomUserAgent, []), - returnValue: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future getCustomUserAgent() => (super.noSuchMethod( + Invocation.method(#getCustomUserAgent, []), + returnValue: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future setAllowsLinkPreview(bool? allow) => - (super.noSuchMethod( - Invocation.method(#setAllowsLinkPreview, [allow]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setAllowsLinkPreview(bool? allow) => (super.noSuchMethod( + Invocation.method(#setAllowsLinkPreview, [allow]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i2.UIViewWKWebView pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeUIViewWKWebView_8( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.UIViewWKWebView); + _i2.UIViewWKWebView pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIViewWKWebView_8( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.UIViewWKWebView); @override - _i4.Future setBackgroundColor(int? value) => - (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [value]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setBackgroundColor(int? value) => (super.noSuchMethod( + 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]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future setOpaque(bool? opaque) => (super.noSuchMethod( + Invocation.method(#setOpaque, [opaque]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future addObserver( @@ -968,20 +836,18 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WKWebViewConfiguration]. @@ -994,138 +860,123 @@ class MockWKWebViewConfiguration extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override _i4.Future setUserContentController( _i2.WKUserContentController? controller, ) => (super.noSuchMethod( - Invocation.method(#setUserContentController, [controller]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setUserContentController, [controller]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( + Invocation.method(#getUserContentController, []), + returnValue: _i4.Future<_i2.WKUserContentController>.value( + _FakeWKUserContentController_9( + this, Invocation.method(#getUserContentController, []), - returnValue: _i4.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_9( - this, - Invocation.method(#getUserContentController, []), - ), - ), - ) - as _i4.Future<_i2.WKUserContentController>); + ), + ), + ) as _i4.Future<_i2.WKUserContentController>); @override _i4.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method(#setWebsiteDataStore, [dataStore]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setWebsiteDataStore, [dataStore]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( + Invocation.method(#getWebsiteDataStore, []), + returnValue: _i4.Future<_i2.WKWebsiteDataStore>.value( + _FakeWKWebsiteDataStore_10( + this, Invocation.method(#getWebsiteDataStore, []), - returnValue: _i4.Future<_i2.WKWebsiteDataStore>.value( - _FakeWKWebsiteDataStore_10( - this, - Invocation.method(#getWebsiteDataStore, []), - ), - ), - ) - as _i4.Future<_i2.WKWebsiteDataStore>); + ), + ), + ) as _i4.Future<_i2.WKWebsiteDataStore>); @override _i4.Future setPreferences(_i2.WKPreferences? preferences) => (super.noSuchMethod( - Invocation.method(#setPreferences, [preferences]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setPreferences, [preferences]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future<_i2.WKPreferences> getPreferences() => - (super.noSuchMethod( + _i4.Future<_i2.WKPreferences> getPreferences() => (super.noSuchMethod( + Invocation.method(#getPreferences, []), + returnValue: _i4.Future<_i2.WKPreferences>.value( + _FakeWKPreferences_4( + this, Invocation.method(#getPreferences, []), - returnValue: _i4.Future<_i2.WKPreferences>.value( - _FakeWKPreferences_4( - this, - Invocation.method(#getPreferences, []), - ), - ), - ) - as _i4.Future<_i2.WKPreferences>); + ), + ), + ) as _i4.Future<_i2.WKPreferences>); @override _i4.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsInlineMediaPlayback, [allow]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future setMediaTypesRequiringUserActionForPlayback( _i2.AudiovisualMediaType? type, ) => (super.noSuchMethod( - Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ - type, - ]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( + Invocation.method(#getDefaultWebpagePreferences, []), + returnValue: _i4.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_11( + this, Invocation.method(#getDefaultWebpagePreferences, []), - returnValue: _i4.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, - Invocation.method(#getDefaultWebpagePreferences, []), - ), - ), - ) - as _i4.Future<_i2.WKWebpagePreferences>); + ), + ), + ) as _i4.Future<_i2.WKWebpagePreferences>); @override - _i2.WKWebViewConfiguration pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebViewConfiguration_7( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebViewConfiguration); + _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebViewConfiguration_7( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebViewConfiguration); @override _i4.Future addObserver( @@ -1134,20 +985,18 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WKWebsiteDataStore]. @@ -1160,37 +1009,31 @@ class MockWKWebsiteDataStore extends _i1.Mock } @override - _i2.WKHTTPCookieStore get httpCookieStore => - (super.noSuchMethod( - Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_12( - this, - Invocation.getter(#httpCookieStore), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( + Invocation.getter(#httpCookieStore), + returnValue: _FakeWKHTTPCookieStore_12( + this, + Invocation.getter(#httpCookieStore), + ), + ) as _i2.WKHTTPCookieStore); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => - (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_12( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_12( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + ) as _i2.WKHTTPCookieStore); @override _i4.Future removeDataOfTypes( @@ -1198,24 +1041,21 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method(#removeDataOfTypes, [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ]), - returnValue: _i4.Future.value(false), - ) - as _i4.Future); + 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( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebsiteDataStore); + _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebsiteDataStore); @override _i4.Future addObserver( @@ -1224,20 +1064,18 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WKUIDelegate]. @@ -1255,28 +1093,25 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { _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, - )); + ) 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( @@ -1284,46 +1119,39 @@ class MockWKUIDelegate extends _i1.Mock implements _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), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); - - @override - _i2.WKUIDelegate pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKUIDelegate_13( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKUIDelegate); + ) 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), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); + + @override + _i2.WKUIDelegate pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUIDelegate_13( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKUIDelegate); @override _i4.Future addObserver( @@ -1332,20 +1160,18 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [WKUserContentController]. @@ -1358,15 +1184,13 @@ class MockWKUserContentController extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override _i4.Future addScriptMessageHandler( @@ -1374,58 +1198,49 @@ class MockWKUserContentController extends _i1.Mock String? name, ) => (super.noSuchMethod( - Invocation.method(#addScriptMessageHandler, [handler, name]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#addScriptMessageHandler, [handler, name]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( - Invocation.method(#removeScriptMessageHandler, [name]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#removeScriptMessageHandler, [name]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future removeAllScriptMessageHandlers() => - (super.noSuchMethod( - Invocation.method(#removeAllScriptMessageHandlers, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( + Invocation.method(#removeAllScriptMessageHandlers, []), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override _i4.Future addUserScript(_i2.WKUserScript? userScript) => (super.noSuchMethod( - Invocation.method(#addUserScript, [userScript]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + Invocation.method(#addUserScript, [userScript]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); @override - _i4.Future removeAllUserScripts() => - (super.noSuchMethod( - Invocation.method(#removeAllUserScripts, []), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + _i4.Future removeAllUserScripts() => (super.noSuchMethod( + 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( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKUserContentController); + _i2.WKUserContentController pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUserContentController_9( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKUserContentController); @override _i4.Future addObserver( @@ -1434,20 +1249,18 @@ class MockWKUserContentController extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) as _i4.Future); } /// A class which mocks [JavascriptChannelRegistry]. @@ -1460,12 +1273,10 @@ class MockJavascriptChannelRegistry extends _i1.Mock } @override - Map get channels => - (super.noSuchMethod( - Invocation.getter(#channels), - returnValue: {}, - ) - as Map); + Map get channels => (super.noSuchMethod( + Invocation.getter(#channels), + returnValue: {}, + ) as Map); @override void onJavascriptChannelMessage(String? channel, String? message) => @@ -1497,37 +1308,36 @@ class MockWebViewPlatformCallbacksHandler extends _i1.Mock required bool? isForMainFrame, }) => (super.noSuchMethod( - Invocation.method(#onNavigationRequest, [], { - #url: url, - #isForMainFrame: isForMainFrame, - }), - returnValue: _i4.Future.value(false), - ) - as _i4.FutureOr); + 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]), - returnValueForMissingStub: null, - ); + Invocation.method(#onPageStarted, [url]), + returnValueForMissingStub: null, + ); @override void onPageFinished(String? url) => super.noSuchMethod( - Invocation.method(#onPageFinished, [url]), - returnValueForMissingStub: null, - ); + Invocation.method(#onPageFinished, [url]), + returnValueForMissingStub: null, + ); @override void onProgress(int? progress) => super.noSuchMethod( - Invocation.method(#onProgress, [progress]), - returnValueForMissingStub: null, - ); + Invocation.method(#onProgress, [progress]), + returnValueForMissingStub: null, + ); @override void onWebResourceError(_i8.WebResourceError? error) => super.noSuchMethod( - Invocation.method(#onWebResourceError, [error]), - returnValueForMissingStub: null, - ); + Invocation.method(#onWebResourceError, [error]), + returnValueForMissingStub: null, + ); } /// A class which mocks [WebViewWidgetProxy]. @@ -1543,35 +1353,32 @@ class MockWebViewWidgetProxy extends _i1.Mock _i3.PlatformWebView createWebView( _i2.WKWebViewConfiguration? configuration, { void Function(String, _i2.NSObject, Map<_i2.KeyValueChangeKey, Object?>)? - observeValue, + observeValue, }) => (super.noSuchMethod( - Invocation.method( - #createWebView, - [configuration], - {#observeValue: observeValue}, - ), - returnValue: _FakePlatformWebView_14( - this, - Invocation.method( - #createWebView, - [configuration], - {#observeValue: observeValue}, - ), - ), - ) - as _i3.PlatformWebView); - - @override - _i2.URLRequest createRequest({required String? url}) => - (super.noSuchMethod( - Invocation.method(#createRequest, [], {#url: url}), - returnValue: _FakeURLRequest_2( - this, - Invocation.method(#createRequest, [], {#url: url}), - ), - ) - as _i2.URLRequest); + Invocation.method( + #createWebView, + [configuration], + {#observeValue: observeValue}, + ), + returnValue: _FakePlatformWebView_14( + this, + Invocation.method( + #createWebView, + [configuration], + {#observeValue: observeValue}, + ), + ), + ) as _i3.PlatformWebView); + + @override + _i2.URLRequest createRequest({required String? url}) => (super.noSuchMethod( + Invocation.method(#createRequest, [], {#url: url}), + returnValue: _FakeURLRequest_2( + this, + Invocation.method(#createRequest, [], {#url: url}), + ), + ) as _i2.URLRequest); @override _i2.WKScriptMessageHandler createScriptMessageHandler({ @@ -1579,21 +1386,19 @@ class MockWebViewWidgetProxy extends _i1.Mock _i2.WKScriptMessageHandler, _i2.WKUserContentController, _i2.WKScriptMessage, - )? - didReceiveScriptMessage, + )? didReceiveScriptMessage, }) => (super.noSuchMethod( - Invocation.method(#createScriptMessageHandler, [], { - #didReceiveScriptMessage: didReceiveScriptMessage, - }), - returnValue: _FakeWKScriptMessageHandler_5( - this, - Invocation.method(#createScriptMessageHandler, [], { - #didReceiveScriptMessage: didReceiveScriptMessage, - }), - ), - ) - as _i2.WKScriptMessageHandler); + Invocation.method(#createScriptMessageHandler, [], { + #didReceiveScriptMessage: didReceiveScriptMessage, + }), + returnValue: _FakeWKScriptMessageHandler_5( + this, + Invocation.method(#createScriptMessageHandler, [], { + #didReceiveScriptMessage: didReceiveScriptMessage, + }), + ), + ) as _i2.WKScriptMessageHandler); @override _i2.WKUIDelegate createUIDelgate({ @@ -1602,86 +1407,77 @@ class MockWebViewWidgetProxy extends _i1.Mock _i2.WKWebView, _i2.WKWebViewConfiguration, _i2.WKNavigationAction, - )? - onCreateWebView, + )? onCreateWebView, }) => (super.noSuchMethod( - Invocation.method(#createUIDelgate, [], { - #onCreateWebView: onCreateWebView, - }), - returnValue: _FakeWKUIDelegate_13( - this, - Invocation.method(#createUIDelgate, [], { - #onCreateWebView: onCreateWebView, - }), - ), - ) - as _i2.WKUIDelegate); + Invocation.method(#createUIDelgate, [], { + #onCreateWebView: onCreateWebView, + }), + returnValue: _FakeWKUIDelegate_13( + this, + Invocation.method(#createUIDelgate, [], { + #onCreateWebView: onCreateWebView, + }), + ), + ) as _i2.WKUIDelegate); @override _i2.WKNavigationDelegate createNavigationDelegate({ void Function(_i2.WKNavigationDelegate, _i2.WKWebView, String?)? - didFinishNavigation, + didFinishNavigation, void Function(_i2.WKNavigationDelegate, _i2.WKWebView, String?)? - didStartProvisionalNavigation, + didStartProvisionalNavigation, required _i4.Future<_i2.NavigationActionPolicy> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.WKNavigationAction, - )? - decidePolicyForNavigationAction, + )? decidePolicyForNavigationAction, void Function(_i2.WKNavigationDelegate, _i2.WKWebView, _i2.NSError)? - didFailNavigation, + didFailNavigation, void Function(_i2.WKNavigationDelegate, _i2.WKWebView, _i2.NSError)? - didFailProvisionalNavigation, + didFailProvisionalNavigation, void Function(_i2.WKNavigationDelegate, _i2.WKWebView)? - webViewWebContentProcessDidTerminate, + webViewWebContentProcessDidTerminate, required _i4.Future<_i2.NavigationResponsePolicy> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.WKNavigationResponse, - )? - decidePolicyForNavigationResponse, + )? decidePolicyForNavigationResponse, required _i4.Future> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.URLAuthenticationChallenge, - )? - didReceiveAuthenticationChallenge, + )? didReceiveAuthenticationChallenge, }) => (super.noSuchMethod( - Invocation.method(#createNavigationDelegate, [], { - #didFinishNavigation: didFinishNavigation, - #didStartProvisionalNavigation: didStartProvisionalNavigation, - #decidePolicyForNavigationAction: decidePolicyForNavigationAction, - #didFailNavigation: didFailNavigation, - #didFailProvisionalNavigation: didFailProvisionalNavigation, - #webViewWebContentProcessDidTerminate: - webViewWebContentProcessDidTerminate, - #decidePolicyForNavigationResponse: - decidePolicyForNavigationResponse, - #didReceiveAuthenticationChallenge: - didReceiveAuthenticationChallenge, - }), - returnValue: _FakeWKNavigationDelegate_3( - this, - Invocation.method(#createNavigationDelegate, [], { - #didFinishNavigation: didFinishNavigation, - #didStartProvisionalNavigation: didStartProvisionalNavigation, - #decidePolicyForNavigationAction: - decidePolicyForNavigationAction, - #didFailNavigation: didFailNavigation, - #didFailProvisionalNavigation: didFailProvisionalNavigation, - #webViewWebContentProcessDidTerminate: - webViewWebContentProcessDidTerminate, - #decidePolicyForNavigationResponse: - decidePolicyForNavigationResponse, - #didReceiveAuthenticationChallenge: - didReceiveAuthenticationChallenge, - }), - ), - ) - as _i2.WKNavigationDelegate); + Invocation.method(#createNavigationDelegate, [], { + #didFinishNavigation: didFinishNavigation, + #didStartProvisionalNavigation: didStartProvisionalNavigation, + #decidePolicyForNavigationAction: decidePolicyForNavigationAction, + #didFailNavigation: didFailNavigation, + #didFailProvisionalNavigation: didFailProvisionalNavigation, + #webViewWebContentProcessDidTerminate: + webViewWebContentProcessDidTerminate, + #decidePolicyForNavigationResponse: decidePolicyForNavigationResponse, + #didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, + }), + returnValue: _FakeWKNavigationDelegate_3( + this, + Invocation.method(#createNavigationDelegate, [], { + #didFinishNavigation: didFinishNavigation, + #didStartProvisionalNavigation: didStartProvisionalNavigation, + #decidePolicyForNavigationAction: decidePolicyForNavigationAction, + #didFailNavigation: didFailNavigation, + #didFailProvisionalNavigation: didFailProvisionalNavigation, + #webViewWebContentProcessDidTerminate: + webViewWebContentProcessDidTerminate, + #decidePolicyForNavigationResponse: + decidePolicyForNavigationResponse, + #didReceiveAuthenticationChallenge: + didReceiveAuthenticationChallenge, + }), + ), + ) as _i2.WKNavigationDelegate); } /// A class which mocks [WKWebpagePreferences]. @@ -1694,35 +1490,30 @@ class MockWKWebpagePreferences extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) 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); + 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_11( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebpagePreferences); + _i2.WKWebpagePreferences pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebpagePreferences_11( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebpagePreferences); @override _i4.Future addObserver( @@ -1731,18 +1522,16 @@ class MockWKWebpagePreferences extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i4.Future.value(), - returnValueForMissingStub: _i4.Future.value(), - ) - as _i4.Future); + 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); + 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.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_navigation_delegate_test.mocks.dart index 36a866a10ab1..214352e8ebf1 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 @@ -27,29 +27,29 @@ 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); + : super(parent, parentInvocation); } class _FakeURLProtectionSpace_1 extends _i1.SmartFake implements _i2.URLProtectionSpace { _FakeURLProtectionSpace_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURLAuthenticationChallenge_2 extends _i1.SmartFake implements _i2.URLAuthenticationChallenge { _FakeURLAuthenticationChallenge_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURLRequest_3 extends _i1.SmartFake implements _i2.URLRequest { _FakeURLRequest_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURL_4 extends _i1.SmartFake implements _i2.URL { _FakeURL_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [URLAuthenticationChallenge]. @@ -62,39 +62,34 @@ class MockURLAuthenticationChallenge extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override _i3.Future<_i2.URLProtectionSpace> getProtectionSpace() => (super.noSuchMethod( + Invocation.method(#getProtectionSpace, []), + returnValue: _i3.Future<_i2.URLProtectionSpace>.value( + _FakeURLProtectionSpace_1( + this, Invocation.method(#getProtectionSpace, []), - returnValue: _i3.Future<_i2.URLProtectionSpace>.value( - _FakeURLProtectionSpace_1( - this, - Invocation.method(#getProtectionSpace, []), - ), - ), - ) - as _i3.Future<_i2.URLProtectionSpace>); + ), + ), + ) as _i3.Future<_i2.URLProtectionSpace>); @override - _i2.URLAuthenticationChallenge pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeURLAuthenticationChallenge_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.URLAuthenticationChallenge); + _i2.URLAuthenticationChallenge pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLAuthenticationChallenge_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.URLAuthenticationChallenge); @override _i3.Future addObserver( @@ -103,20 +98,18 @@ class MockURLAuthenticationChallenge extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [URLProtectionSpace]. @@ -129,46 +122,38 @@ class MockURLProtectionSpace extends _i1.Mock } @override - String get host => - (super.noSuchMethod( - Invocation.getter(#host), - returnValue: _i4.dummyValue(this, Invocation.getter(#host)), - ) - as String); + String get host => (super.noSuchMethod( + Invocation.getter(#host), + returnValue: _i4.dummyValue(this, Invocation.getter(#host)), + ) as String); @override int get port => (super.noSuchMethod(Invocation.getter(#port), returnValue: 0) as int); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i3.Future<_i2.SecTrust?> getServerTrust() => - (super.noSuchMethod( - Invocation.method(#getServerTrust, []), - returnValue: _i3.Future<_i2.SecTrust?>.value(), - ) - as _i3.Future<_i2.SecTrust?>); + _i3.Future<_i2.SecTrust?> getServerTrust() => (super.noSuchMethod( + Invocation.method(#getServerTrust, []), + returnValue: _i3.Future<_i2.SecTrust?>.value(), + ) as _i3.Future<_i2.SecTrust?>); @override - _i2.URLProtectionSpace pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeURLProtectionSpace_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.URLProtectionSpace); + _i2.URLProtectionSpace pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLProtectionSpace_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.URLProtectionSpace); @override _i3.Future addObserver( @@ -177,20 +162,18 @@ class MockURLProtectionSpace extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [URLRequest]. @@ -202,85 +185,69 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i3.Future getUrl() => - (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future getUrl() => (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future setHttpMethod(String? method) => - (super.noSuchMethod( - Invocation.method(#setHttpMethod, [method]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setHttpMethod(String? method) => (super.noSuchMethod( + Invocation.method(#setHttpMethod, [method]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future getHttpMethod() => - (super.noSuchMethod( - Invocation.method(#getHttpMethod, []), - returnValue: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future getHttpMethod() => (super.noSuchMethod( + Invocation.method(#getHttpMethod, []), + returnValue: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future setHttpBody(_i5.Uint8List? body) => - (super.noSuchMethod( - Invocation.method(#setHttpBody, [body]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setHttpBody(_i5.Uint8List? body) => (super.noSuchMethod( + 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, []), - returnValue: _i3.Future<_i5.Uint8List?>.value(), - ) - as _i3.Future<_i5.Uint8List?>); + _i3.Future<_i5.Uint8List?> getHttpBody() => (super.noSuchMethod( + Invocation.method(#getHttpBody, []), + returnValue: _i3.Future<_i5.Uint8List?>.value(), + ) as _i3.Future<_i5.Uint8List?>); @override _i3.Future setAllHttpHeaderFields(Map? fields) => (super.noSuchMethod( - Invocation.method(#setAllHttpHeaderFields, [fields]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setAllHttpHeaderFields, [fields]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method(#getAllHttpHeaderFields, []), - returnValue: _i3.Future?>.value(), - ) - as _i3.Future?>); + Invocation.method(#getAllHttpHeaderFields, []), + returnValue: _i3.Future?>.value(), + ) as _i3.Future?>); @override - _i2.URLRequest pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeURLRequest_3( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.URLRequest); + _i2.URLRequest pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLRequest_3( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.URLRequest); @override _i3.Future addObserver( @@ -289,20 +256,18 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [URL]. @@ -314,36 +279,30 @@ class MockURL extends _i1.Mock implements _i2.URL { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i3.Future getAbsoluteString() => - (super.noSuchMethod( + _i3.Future getAbsoluteString() => (super.noSuchMethod( + Invocation.method(#getAbsoluteString, []), + returnValue: _i3.Future.value( + _i4.dummyValue( + this, Invocation.method(#getAbsoluteString, []), - returnValue: _i3.Future.value( - _i4.dummyValue( - this, - Invocation.method(#getAbsoluteString, []), - ), - ), - ) - as _i3.Future); + ), + ), + ) as _i3.Future); @override - _i2.URL pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeURL_4(this, Invocation.method(#pigeon_copy, [])), - ) - as _i2.URL); + _i2.URL pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURL_4(this, Invocation.method(#pigeon_copy, [])), + ) as _i2.URL); @override _i3.Future addObserver( @@ -352,18 +311,16 @@ class MockURL extends _i1.Mock implements _i2.URL { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + 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.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart index a32e07bfdf22..3bbeec9f6c3a 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 @@ -27,85 +27,85 @@ 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); + : super(parent, parentInvocation); } class _FakeUIScrollView_1 extends _i1.SmartFake implements _i2.UIScrollView { _FakeUIScrollView_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeUIScrollViewDelegate_2 extends _i1.SmartFake implements _i2.UIScrollViewDelegate { _FakeUIScrollViewDelegate_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURL_3 extends _i1.SmartFake implements _i2.URL { _FakeURL_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeURLRequest_4 extends _i1.SmartFake implements _i2.URLRequest { _FakeURLRequest_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKPreferences_5 extends _i1.SmartFake implements _i2.WKPreferences { _FakeWKPreferences_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKScriptMessageHandler_6 extends _i1.SmartFake implements _i2.WKScriptMessageHandler { _FakeWKScriptMessageHandler_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUserContentController_7 extends _i1.SmartFake implements _i2.WKUserContentController { _FakeWKUserContentController_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUserScript_8 extends _i1.SmartFake implements _i2.WKUserScript { _FakeWKUserScript_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebView_9 extends _i1.SmartFake implements _i2.WKWebView { _FakeWKWebView_9(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_10 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_10(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebpagePreferences_11 extends _i1.SmartFake implements _i2.WKWebpagePreferences { _FakeWKWebpagePreferences_11(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebViewConfiguration_12 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { _FakeWKWebViewConfiguration_12(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeUIViewWKWebView_13 extends _i1.SmartFake implements _i2.UIViewWKWebView { _FakeUIViewWKWebView_13(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKHTTPCookieStore_14 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { _FakeWKHTTPCookieStore_14(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [UIScrollView]. @@ -113,135 +113,112 @@ class _FakeWKHTTPCookieStore_14 extends _i1.SmartFake /// See the documentation for Mockito's code generation for more information. class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @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> getContentOffset() => - (super.noSuchMethod( - Invocation.method(#getContentOffset, []), - returnValue: _i3.Future>.value([]), - returnValueForMissingStub: _i3.Future>.value( - [], - ), - ) - as _i3.Future>); + _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 scrollBy(double? x, double? y) => - (super.noSuchMethod( - Invocation.method(#scrollBy, [x, y]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future> getContentOffset() => (super.noSuchMethod( + Invocation.method(#getContentOffset, []), + returnValue: _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]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future setContentOffset(double? x, double? y) => (super.noSuchMethod( - Invocation.method(#setContentOffset, [x, y]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setContentOffset, [x, y]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future setDelegate(_i2.UIScrollViewDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setDelegate, [delegate]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + _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); + _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); + _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); + _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); + 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, []), - returnValue: _FakeUIScrollView_1( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeUIScrollView_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.UIScrollView); - - @override - _i3.Future setBackgroundColor(int? value) => - (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [value]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i2.UIScrollView pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollView_1( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeUIScrollView_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.UIScrollView); @override - _i3.Future setOpaque(bool? opaque) => - (super.noSuchMethod( - Invocation.method(#setOpaque, [opaque]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setBackgroundColor(int? value) => (super.noSuchMethod( + 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]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future addObserver( @@ -250,20 +227,18 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [UIScrollViewDelegate]. @@ -272,34 +247,30 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { class MockUIScrollViewDelegate extends _i1.Mock implements _i2.UIScrollViewDelegate { @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 - _i2.UIScrollViewDelegate pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeUIScrollViewDelegate_2( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeUIScrollViewDelegate_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.UIScrollViewDelegate); + _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 + _i2.UIScrollViewDelegate pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollViewDelegate_2( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeUIScrollViewDelegate_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.UIScrollViewDelegate); @override _i3.Future addObserver( @@ -308,20 +279,18 @@ class MockUIScrollViewDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [URL]. @@ -329,50 +298,44 @@ class MockUIScrollViewDelegate extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockURL extends _i1.Mock implements _i2.URL { @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 getAbsoluteString() => - (super.noSuchMethod( + _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 getAbsoluteString() => (super.noSuchMethod( + Invocation.method(#getAbsoluteString, []), + returnValue: _i3.Future.value( + _i4.dummyValue( + this, Invocation.method(#getAbsoluteString, []), - returnValue: _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, [])), - returnValueForMissingStub: _FakeURL_3( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.URL); + ), + ), + 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, [])), + returnValueForMissingStub: _FakeURL_3( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.URL); @override _i3.Future addObserver( @@ -381,20 +344,18 @@ class MockURL extends _i1.Mock implements _i2.URL { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [URLRequest]. @@ -402,97 +363,81 @@ class MockURL extends _i1.Mock implements _i2.URL { /// See the documentation for Mockito's code generation for more information. class MockURLRequest extends _i1.Mock implements _i2.URLRequest { @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 getUrl() => - (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _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 setHttpMethod(String? method) => - (super.noSuchMethod( - Invocation.method(#setHttpMethod, [method]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future getUrl() => (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future getHttpMethod() => - (super.noSuchMethod( - Invocation.method(#getHttpMethod, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setHttpMethod(String? method) => (super.noSuchMethod( + Invocation.method(#setHttpMethod, [method]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future setHttpBody(_i5.Uint8List? body) => - (super.noSuchMethod( - Invocation.method(#setHttpBody, [body]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future getHttpMethod() => (super.noSuchMethod( + Invocation.method(#getHttpMethod, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future<_i5.Uint8List?> getHttpBody() => - (super.noSuchMethod( - Invocation.method(#getHttpBody, []), - returnValue: _i3.Future<_i5.Uint8List?>.value(), - returnValueForMissingStub: _i3.Future<_i5.Uint8List?>.value(), - ) - as _i3.Future<_i5.Uint8List?>); + _i3.Future setHttpBody(_i5.Uint8List? body) => (super.noSuchMethod( + 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, []), + returnValue: _i3.Future<_i5.Uint8List?>.value(), + returnValueForMissingStub: _i3.Future<_i5.Uint8List?>.value(), + ) as _i3.Future<_i5.Uint8List?>); @override _i3.Future setAllHttpHeaderFields(Map? fields) => (super.noSuchMethod( - Invocation.method(#setAllHttpHeaderFields, [fields]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setAllHttpHeaderFields, [fields]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future?> getAllHttpHeaderFields() => (super.noSuchMethod( - Invocation.method(#getAllHttpHeaderFields, []), - returnValue: _i3.Future?>.value(), - returnValueForMissingStub: _i3.Future?>.value(), - ) - as _i3.Future?>); + 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, []), - returnValue: _FakeURLRequest_4( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeURLRequest_4( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.URLRequest); + _i2.URLRequest pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeURLRequest_4( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeURLRequest_4( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.URLRequest); @override _i3.Future addObserver( @@ -501,20 +446,18 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKPreferences]. @@ -522,43 +465,37 @@ class MockURLRequest extends _i1.Mock implements _i2.URLRequest { /// See the documentation for Mockito's code generation for more information. class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { @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 setJavaScriptEnabled(bool? enabled) => - (super.noSuchMethod( - 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, []), - returnValue: _FakeWKPreferences_5( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKPreferences_5( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKPreferences); + _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 setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod( + 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, []), + returnValue: _FakeWKPreferences_5( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKPreferences_5( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKPreferences); @override _i3.Future addObserver( @@ -567,20 +504,18 @@ class MockWKPreferences extends _i1.Mock implements _i2.WKPreferences { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKScriptMessageHandler]. @@ -593,58 +528,49 @@ class MockWKScriptMessageHandler extends _i1.Mock _i2.WKScriptMessageHandler, _i2.WKUserContentController, _i2.WKScriptMessage, - ) - get didReceiveScriptMessage => - (super.noSuchMethod( - Invocation.getter(#didReceiveScriptMessage), - returnValue: - ( - _i2.WKScriptMessageHandler pigeon_instance, - _i2.WKUserContentController controller, - _i2.WKScriptMessage message, - ) {}, - returnValueForMissingStub: - ( - _i2.WKScriptMessageHandler pigeon_instance, - _i2.WKUserContentController controller, - _i2.WKScriptMessage message, - ) {}, - ) - as void Function( - _i2.WKScriptMessageHandler, - _i2.WKUserContentController, - _i2.WKScriptMessage, - )); - - @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 - _i2.WKScriptMessageHandler pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKScriptMessageHandler_6( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKScriptMessageHandler_6( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKScriptMessageHandler); + ) get didReceiveScriptMessage => (super.noSuchMethod( + Invocation.getter(#didReceiveScriptMessage), + returnValue: ( + _i2.WKScriptMessageHandler pigeon_instance, + _i2.WKUserContentController controller, + _i2.WKScriptMessage message, + ) {}, + returnValueForMissingStub: ( + _i2.WKScriptMessageHandler pigeon_instance, + _i2.WKUserContentController controller, + _i2.WKScriptMessage message, + ) {}, + ) as void Function( + _i2.WKScriptMessageHandler, + _i2.WKUserContentController, + _i2.WKScriptMessage, + )); + + @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 + _i2.WKScriptMessageHandler pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKScriptMessageHandler_6( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKScriptMessageHandler_6( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKScriptMessageHandler); @override _i3.Future addObserver( @@ -653,20 +579,18 @@ class MockWKScriptMessageHandler extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKUserContentController]. @@ -675,19 +599,17 @@ class MockWKScriptMessageHandler extends _i1.Mock class MockWKUserContentController extends _i1.Mock implements _i2.WKUserContentController { @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); + _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 addScriptMessageHandler( @@ -695,62 +617,53 @@ class MockWKUserContentController extends _i1.Mock String? name, ) => (super.noSuchMethod( - Invocation.method(#addScriptMessageHandler, [handler, name]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#addScriptMessageHandler, [handler, name]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future removeScriptMessageHandler(String? name) => (super.noSuchMethod( - Invocation.method(#removeScriptMessageHandler, [name]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#removeScriptMessageHandler, [name]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future removeAllScriptMessageHandlers() => - (super.noSuchMethod( - Invocation.method(#removeAllScriptMessageHandlers, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future removeAllScriptMessageHandlers() => (super.noSuchMethod( + Invocation.method(#removeAllScriptMessageHandlers, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future addUserScript(_i2.WKUserScript? userScript) => (super.noSuchMethod( - Invocation.method(#addUserScript, [userScript]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#addUserScript, [userScript]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future removeAllUserScripts() => - (super.noSuchMethod( - Invocation.method(#removeAllUserScripts, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future removeAllUserScripts() => (super.noSuchMethod( + 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, []), - returnValue: _FakeWKUserContentController_7( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKUserContentController_7( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKUserContentController); + _i2.WKUserContentController pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUserContentController_7( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKUserContentController_7( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKUserContentController); @override _i3.Future addObserver( @@ -759,20 +672,18 @@ class MockWKUserContentController extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKUserScript]. @@ -780,68 +691,57 @@ class MockWKUserContentController extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockWKUserScript extends _i1.Mock implements _i2.WKUserScript { @override - String get source => - (super.noSuchMethod( - Invocation.getter(#source), - returnValue: _i4.dummyValue( - this, - Invocation.getter(#source), - ), - returnValueForMissingStub: _i4.dummyValue( - this, - Invocation.getter(#source), - ), - ) - as String); - - @override - _i2.UserScriptInjectionTime get injectionTime => - (super.noSuchMethod( - Invocation.getter(#injectionTime), - returnValue: _i2.UserScriptInjectionTime.atDocumentStart, - returnValueForMissingStub: - _i2.UserScriptInjectionTime.atDocumentStart, - ) - as _i2.UserScriptInjectionTime); - - @override - bool get isForMainFrameOnly => - (super.noSuchMethod( - Invocation.getter(#isForMainFrameOnly), - returnValue: false, - returnValueForMissingStub: false, - ) - as bool); - - @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 - _i2.WKUserScript pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKUserScript_8( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKUserScript_8( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKUserScript); + String get source => (super.noSuchMethod( + Invocation.getter(#source), + returnValue: _i4.dummyValue( + this, + Invocation.getter(#source), + ), + returnValueForMissingStub: _i4.dummyValue( + this, + Invocation.getter(#source), + ), + ) as String); + + @override + _i2.UserScriptInjectionTime get injectionTime => (super.noSuchMethod( + Invocation.getter(#injectionTime), + returnValue: _i2.UserScriptInjectionTime.atDocumentStart, + returnValueForMissingStub: _i2.UserScriptInjectionTime.atDocumentStart, + ) as _i2.UserScriptInjectionTime); + + @override + bool get isForMainFrameOnly => (super.noSuchMethod( + Invocation.getter(#isForMainFrameOnly), + returnValue: false, + returnValueForMissingStub: false, + ) as bool); + + @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 + _i2.WKUserScript pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUserScript_8( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKUserScript_8( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKUserScript); @override _i3.Future addObserver( @@ -850,20 +750,18 @@ class MockWKUserScript extends _i1.Mock implements _i2.WKUserScript { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKWebView]. @@ -871,34 +769,30 @@ class MockWKUserScript extends _i1.Mock implements _i2.WKUserScript { /// See the documentation for Mockito's code generation for more information. class MockWKWebView extends _i1.Mock implements _i2.WKWebView { @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 - _i2.WKWebView pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebView_9( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKWebView_9( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebView); + _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 + _i2.WKWebView pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebView_9( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKWebView_9( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebView); @override _i3.Future addObserver( @@ -907,20 +801,18 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKWebViewConfiguration]. @@ -929,172 +821,156 @@ class MockWKWebView extends _i1.Mock implements _i2.WKWebView { class MockWKWebViewConfiguration extends _i1.Mock implements _i2.WKWebViewConfiguration { @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); + _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 setUserContentController( _i2.WKUserContentController? controller, ) => (super.noSuchMethod( - Invocation.method(#setUserContentController, [controller]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setUserContentController, [controller]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( + Invocation.method(#getUserContentController, []), + returnValue: _i3.Future<_i2.WKUserContentController>.value( + _FakeWKUserContentController_7( + this, + Invocation.method(#getUserContentController, []), + ), + ), + returnValueForMissingStub: + _i3.Future<_i2.WKUserContentController>.value( + _FakeWKUserContentController_7( + this, Invocation.method(#getUserContentController, []), - returnValue: _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_7( - this, - Invocation.method(#getUserContentController, []), - ), - ), - returnValueForMissingStub: - _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_7( - this, - Invocation.method(#getUserContentController, []), - ), - ), - ) - as _i3.Future<_i2.WKUserContentController>); + ), + ), + ) as _i3.Future<_i2.WKUserContentController>); @override _i3.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method(#setWebsiteDataStore, [dataStore]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setWebsiteDataStore, [dataStore]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( + Invocation.method(#getWebsiteDataStore, []), + returnValue: _i3.Future<_i2.WKWebsiteDataStore>.value( + _FakeWKWebsiteDataStore_10( + this, 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, []), - ), - ), - ) - as _i3.Future<_i2.WKWebsiteDataStore>); + ), + ), + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setPreferences, [preferences]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future<_i2.WKPreferences> getPreferences() => - (super.noSuchMethod( + _i3.Future<_i2.WKPreferences> getPreferences() => (super.noSuchMethod( + 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, []), - returnValue: _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>); + ), + ), + ) as _i3.Future<_i2.WKPreferences>); @override _i3.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsInlineMediaPlayback, [allow]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future setMediaTypesRequiringUserActionForPlayback( _i2.AudiovisualMediaType? type, ) => (super.noSuchMethod( - Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ - type, - ]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( + Invocation.method(#getDefaultWebpagePreferences, []), + returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_11( + this, Invocation.method(#getDefaultWebpagePreferences, []), - returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, - Invocation.method(#getDefaultWebpagePreferences, []), - ), - ), - returnValueForMissingStub: - _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, - Invocation.method(#getDefaultWebpagePreferences, []), - ), - ), - ) - 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, []), - ), - ) - as _i2.WKWebViewConfiguration); + ), + ), + returnValueForMissingStub: _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_11( + this, + Invocation.method(#getDefaultWebpagePreferences, []), + ), + ), + ) 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, []), + ), + ) as _i2.WKWebViewConfiguration); @override _i3.Future addObserver( @@ -1103,20 +979,18 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKWebpagePreferences]. @@ -1125,43 +999,38 @@ class MockWKWebViewConfiguration extends _i1.Mock 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); + _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); + Invocation.method(#setAllowsContentJavaScript, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _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); + _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( @@ -1170,20 +1039,18 @@ class MockWKWebpagePreferences extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [UIViewWKWebView]. @@ -1191,292 +1058,242 @@ class MockWKWebpagePreferences extends _i1.Mock /// See the documentation for Mockito's code generation for more information. class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override - _i2.WKWebViewConfiguration get configuration => - (super.noSuchMethod( - Invocation.getter(#configuration), - returnValue: _FakeWKWebViewConfiguration_12( - this, - Invocation.getter(#configuration), - ), - returnValueForMissingStub: _FakeWKWebViewConfiguration_12( - this, - Invocation.getter(#configuration), - ), - ) - as _i2.WKWebViewConfiguration); - - @override - _i2.UIScrollView get scrollView => - (super.noSuchMethod( - Invocation.getter(#scrollView), - returnValue: _FakeUIScrollView_1( - this, - Invocation.getter(#scrollView), - ), - returnValueForMissingStub: _FakeUIScrollView_1( - this, - Invocation.getter(#scrollView), - ), - ) - as _i2.UIScrollView); - - @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 - _i2.WKWebViewConfiguration pigeonVar_configuration() => - (super.noSuchMethod( - Invocation.method(#pigeonVar_configuration, []), - returnValue: _FakeWKWebViewConfiguration_12( - this, - Invocation.method(#pigeonVar_configuration, []), - ), - returnValueForMissingStub: _FakeWKWebViewConfiguration_12( - this, - Invocation.method(#pigeonVar_configuration, []), - ), - ) - as _i2.WKWebViewConfiguration); - - @override - _i2.UIScrollView pigeonVar_scrollView() => - (super.noSuchMethod( - Invocation.method(#pigeonVar_scrollView, []), - returnValue: _FakeUIScrollView_1( - this, - Invocation.method(#pigeonVar_scrollView, []), - ), - returnValueForMissingStub: _FakeUIScrollView_1( - this, - Invocation.method(#pigeonVar_scrollView, []), - ), - ) - as _i2.UIScrollView); + _i2.WKWebViewConfiguration get configuration => (super.noSuchMethod( + Invocation.getter(#configuration), + returnValue: _FakeWKWebViewConfiguration_12( + this, + Invocation.getter(#configuration), + ), + returnValueForMissingStub: _FakeWKWebViewConfiguration_12( + this, + Invocation.getter(#configuration), + ), + ) as _i2.WKWebViewConfiguration); + + @override + _i2.UIScrollView get scrollView => (super.noSuchMethod( + Invocation.getter(#scrollView), + returnValue: _FakeUIScrollView_1( + this, + Invocation.getter(#scrollView), + ), + returnValueForMissingStub: _FakeUIScrollView_1( + this, + Invocation.getter(#scrollView), + ), + ) as _i2.UIScrollView); + + @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 + _i2.WKWebViewConfiguration pigeonVar_configuration() => (super.noSuchMethod( + Invocation.method(#pigeonVar_configuration, []), + returnValue: _FakeWKWebViewConfiguration_12( + this, + Invocation.method(#pigeonVar_configuration, []), + ), + returnValueForMissingStub: _FakeWKWebViewConfiguration_12( + this, + Invocation.method(#pigeonVar_configuration, []), + ), + ) as _i2.WKWebViewConfiguration); + + @override + _i2.UIScrollView pigeonVar_scrollView() => (super.noSuchMethod( + Invocation.method(#pigeonVar_scrollView, []), + returnValue: _FakeUIScrollView_1( + this, + Invocation.method(#pigeonVar_scrollView, []), + ), + returnValueForMissingStub: _FakeUIScrollView_1( + this, + Invocation.method(#pigeonVar_scrollView, []), + ), + ) as _i2.UIScrollView); @override _i3.Future setUIDelegate(_i2.WKUIDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setUIDelegate, [delegate]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setUIDelegate, [delegate]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future setNavigationDelegate(_i2.WKNavigationDelegate? delegate) => (super.noSuchMethod( - Invocation.method(#setNavigationDelegate, [delegate]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setNavigationDelegate, [delegate]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future getUrl() => - (super.noSuchMethod( - Invocation.method(#getUrl, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future getUrl() => (super.noSuchMethod( + Invocation.method(#getUrl, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future getEstimatedProgress() => - (super.noSuchMethod( - Invocation.method(#getEstimatedProgress, []), - returnValue: _i3.Future.value(0.0), - returnValueForMissingStub: _i3.Future.value(0.0), - ) - as _i3.Future); + _i3.Future getEstimatedProgress() => (super.noSuchMethod( + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future load(_i2.URLRequest? request) => (super.noSuchMethod( + Invocation.method(#load, [request]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future loadHtmlString(String? string, String? baseUrl) => (super.noSuchMethod( - Invocation.method(#loadHtmlString, [string, baseUrl]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#loadHtmlString, [string, baseUrl]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future loadFileUrl(String? url, String? readAccessUrl) => (super.noSuchMethod( - Invocation.method(#loadFileUrl, [url, readAccessUrl]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future loadFlutterAsset(String? key) => (super.noSuchMethod( + Invocation.method(#loadFlutterAsset, [key]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future canGoBack() => - (super.noSuchMethod( - Invocation.method(#canGoBack, []), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) - as _i3.Future); + _i3.Future canGoBack() => (super.noSuchMethod( + 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, []), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) - as _i3.Future); + _i3.Future canGoForward() => (super.noSuchMethod( + 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, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future goBack() => (super.noSuchMethod( + Invocation.method(#goBack, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future goForward() => - (super.noSuchMethod( - Invocation.method(#goForward, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future goForward() => (super.noSuchMethod( + Invocation.method(#goForward, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future reload() => - (super.noSuchMethod( - Invocation.method(#reload, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future reload() => (super.noSuchMethod( + Invocation.method(#reload, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future getTitle() => - (super.noSuchMethod( - Invocation.method(#getTitle, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future getTitle() => (super.noSuchMethod( + Invocation.method(#getTitle, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future setAllowsBackForwardNavigationGestures(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsBackForwardNavigationGestures, [allow]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setCustomUserAgent(String? userAgent) => (super.noSuchMethod( + Invocation.method(#setCustomUserAgent, [userAgent]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future evaluateJavaScript(String? javaScriptString) => (super.noSuchMethod( - Invocation.method(#evaluateJavaScript, [javaScriptString]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setInspectable(bool? inspectable) => (super.noSuchMethod( + Invocation.method(#setInspectable, [inspectable]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future getCustomUserAgent() => - (super.noSuchMethod( - Invocation.method(#getCustomUserAgent, []), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future getCustomUserAgent() => (super.noSuchMethod( + Invocation.method(#getCustomUserAgent, []), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future setAllowsLinkPreview(bool? allow) => - (super.noSuchMethod( - Invocation.method(#setAllowsLinkPreview, [allow]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setAllowsLinkPreview(bool? allow) => (super.noSuchMethod( + Invocation.method(#setAllowsLinkPreview, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i2.UIViewWKWebView pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeUIViewWKWebView_13( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeUIViewWKWebView_13( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.UIViewWKWebView); - - @override - _i3.Future setBackgroundColor(int? value) => - (super.noSuchMethod( - Invocation.method(#setBackgroundColor, [value]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i2.UIViewWKWebView pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIViewWKWebView_13( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeUIViewWKWebView_13( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.UIViewWKWebView); @override - _i3.Future setOpaque(bool? opaque) => - (super.noSuchMethod( - Invocation.method(#setOpaque, [opaque]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setBackgroundColor(int? value) => (super.noSuchMethod( + 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]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future addObserver( @@ -1485,20 +1302,18 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKWebsiteDataStore]. @@ -1507,49 +1322,43 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { class MockWKWebsiteDataStore extends _i1.Mock implements _i2.WKWebsiteDataStore { @override - _i2.WKHTTPCookieStore get httpCookieStore => - (super.noSuchMethod( - Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_14( - this, - Invocation.getter(#httpCookieStore), - ), - returnValueForMissingStub: _FakeWKHTTPCookieStore_14( - this, - Invocation.getter(#httpCookieStore), - ), - ) - as _i2.WKHTTPCookieStore); - - @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 - _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => - (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_14( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - returnValueForMissingStub: _FakeWKHTTPCookieStore_14( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( + Invocation.getter(#httpCookieStore), + returnValue: _FakeWKHTTPCookieStore_14( + this, + Invocation.getter(#httpCookieStore), + ), + returnValueForMissingStub: _FakeWKHTTPCookieStore_14( + this, + Invocation.getter(#httpCookieStore), + ), + ) as _i2.WKHTTPCookieStore); + + @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 + _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_14( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + returnValueForMissingStub: _FakeWKHTTPCookieStore_14( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + ) as _i2.WKHTTPCookieStore); @override _i3.Future removeDataOfTypes( @@ -1557,29 +1366,26 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method(#removeDataOfTypes, [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ]), - returnValue: _i3.Future.value(false), - returnValueForMissingStub: _i3.Future.value(false), - ) - as _i3.Future); + 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, []), - returnValue: _FakeWKWebsiteDataStore_10( - this, - Invocation.method(#pigeon_copy, []), - ), - returnValueForMissingStub: _FakeWKWebsiteDataStore_10( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebsiteDataStore); + _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#pigeon_copy, []), + ), + returnValueForMissingStub: _FakeWKWebsiteDataStore_10( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebsiteDataStore); @override _i3.Future addObserver( @@ -1588,18 +1394,16 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + 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 ce8c5682afca..d494fbba2091 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 @@ -25,19 +25,19 @@ 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); + : super(parent, parentInvocation); } class _FakePigeonInstanceManager_1 extends _i1.SmartFake implements _i2.PigeonInstanceManager { _FakePigeonInstanceManager_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_2 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [WKWebsiteDataStore]. @@ -50,37 +50,31 @@ class MockWKWebsiteDataStore extends _i1.Mock } @override - _i2.WKHTTPCookieStore get httpCookieStore => - (super.noSuchMethod( - Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_0( - this, - Invocation.getter(#httpCookieStore), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( + Invocation.getter(#httpCookieStore), + returnValue: _FakeWKHTTPCookieStore_0( + this, + Invocation.getter(#httpCookieStore), + ), + ) as _i2.WKHTTPCookieStore); @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_1( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_1( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => - (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_0( - this, - Invocation.method(#pigeonVar_httpCookieStore, []), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( + Invocation.method(#pigeonVar_httpCookieStore, []), + returnValue: _FakeWKHTTPCookieStore_0( + this, + Invocation.method(#pigeonVar_httpCookieStore, []), + ), + ) as _i2.WKHTTPCookieStore); @override _i3.Future removeDataOfTypes( @@ -88,24 +82,21 @@ class MockWKWebsiteDataStore extends _i1.Mock double? modificationTimeInSecondsSinceEpoch, ) => (super.noSuchMethod( - Invocation.method(#removeDataOfTypes, [ - dataTypes, - modificationTimeInSecondsSinceEpoch, - ]), - returnValue: _i3.Future.value(false), - ) - as _i3.Future); + Invocation.method(#removeDataOfTypes, [ + dataTypes, + modificationTimeInSecondsSinceEpoch, + ]), + returnValue: _i3.Future.value(false), + ) as _i3.Future); @override - _i2.WKWebsiteDataStore pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebsiteDataStore_2( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebsiteDataStore); + _i2.WKWebsiteDataStore pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebsiteDataStore_2( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebsiteDataStore); @override _i3.Future addObserver( @@ -114,20 +105,18 @@ class MockWKWebsiteDataStore extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKHTTPCookieStore]. @@ -139,35 +128,29 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_1( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_1( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i3.Future setCookie(_i2.HTTPCookie? cookie) => - (super.noSuchMethod( - Invocation.method(#setCookie, [cookie]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + _i3.Future setCookie(_i2.HTTPCookie? cookie) => (super.noSuchMethod( + 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, []), - returnValue: _FakeWKHTTPCookieStore_0( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKHTTPCookieStore); + _i2.WKHTTPCookieStore pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKHTTPCookieStore_0( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKHTTPCookieStore); @override _i3.Future addObserver( @@ -176,18 +159,16 @@ class MockWKHTTPCookieStore extends _i1.Mock implements _i2.WKHTTPCookieStore { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + 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 2e977a8f1a85..ce4ab60e4a0e 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 @@ -25,47 +25,47 @@ 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); + : super(parent, parentInvocation); } class _FakeWKUIDelegate_1 extends _i1.SmartFake implements _i2.WKUIDelegate { _FakeWKUIDelegate_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKUserContentController_2 extends _i1.SmartFake implements _i2.WKUserContentController { _FakeWKUserContentController_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebsiteDataStore_3 extends _i1.SmartFake implements _i2.WKWebsiteDataStore { _FakeWKWebsiteDataStore_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKPreferences_4 extends _i1.SmartFake implements _i2.WKPreferences { _FakeWKPreferences_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebpagePreferences_5 extends _i1.SmartFake implements _i2.WKWebpagePreferences { _FakeWKWebpagePreferences_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeWKWebViewConfiguration_6 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { _FakeWKWebViewConfiguration_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } class _FakeUIScrollViewDelegate_7 extends _i1.SmartFake implements _i2.UIScrollViewDelegate { _FakeUIScrollViewDelegate_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + : super(parent, parentInvocation); } /// A class which mocks [WKUIDelegate]. @@ -83,28 +83,25 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { _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, - )); + ) 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( @@ -112,46 +109,39 @@ class MockWKUIDelegate extends _i1.Mock implements _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, - )); + ) 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), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i2.WKUIDelegate pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKUIDelegate_1( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKUIDelegate); + _i2.WKUIDelegate pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKUIDelegate_1( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKUIDelegate); @override _i3.Future addObserver( @@ -160,20 +150,18 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [WKWebViewConfiguration]. @@ -186,138 +174,123 @@ class MockWKWebViewConfiguration extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override _i3.Future setUserContentController( _i2.WKUserContentController? controller, ) => (super.noSuchMethod( - Invocation.method(#setUserContentController, [controller]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setUserContentController, [controller]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future<_i2.WKUserContentController> getUserContentController() => (super.noSuchMethod( + Invocation.method(#getUserContentController, []), + returnValue: _i3.Future<_i2.WKUserContentController>.value( + _FakeWKUserContentController_2( + this, Invocation.method(#getUserContentController, []), - returnValue: _i3.Future<_i2.WKUserContentController>.value( - _FakeWKUserContentController_2( - this, - Invocation.method(#getUserContentController, []), - ), - ), - ) - as _i3.Future<_i2.WKUserContentController>); + ), + ), + ) as _i3.Future<_i2.WKUserContentController>); @override _i3.Future setWebsiteDataStore(_i2.WKWebsiteDataStore? dataStore) => (super.noSuchMethod( - Invocation.method(#setWebsiteDataStore, [dataStore]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setWebsiteDataStore, [dataStore]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future<_i2.WKWebsiteDataStore> getWebsiteDataStore() => (super.noSuchMethod( + Invocation.method(#getWebsiteDataStore, []), + returnValue: _i3.Future<_i2.WKWebsiteDataStore>.value( + _FakeWKWebsiteDataStore_3( + this, Invocation.method(#getWebsiteDataStore, []), - returnValue: _i3.Future<_i2.WKWebsiteDataStore>.value( - _FakeWKWebsiteDataStore_3( - this, - Invocation.method(#getWebsiteDataStore, []), - ), - ), - ) - as _i3.Future<_i2.WKWebsiteDataStore>); + ), + ), + ) as _i3.Future<_i2.WKWebsiteDataStore>); @override _i3.Future setPreferences(_i2.WKPreferences? preferences) => (super.noSuchMethod( - Invocation.method(#setPreferences, [preferences]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setPreferences, [preferences]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override - _i3.Future<_i2.WKPreferences> getPreferences() => - (super.noSuchMethod( + _i3.Future<_i2.WKPreferences> getPreferences() => (super.noSuchMethod( + Invocation.method(#getPreferences, []), + returnValue: _i3.Future<_i2.WKPreferences>.value( + _FakeWKPreferences_4( + this, Invocation.method(#getPreferences, []), - returnValue: _i3.Future<_i2.WKPreferences>.value( - _FakeWKPreferences_4( - this, - Invocation.method(#getPreferences, []), - ), - ), - ) - as _i3.Future<_i2.WKPreferences>); + ), + ), + ) as _i3.Future<_i2.WKPreferences>); @override _i3.Future setAllowsInlineMediaPlayback(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsInlineMediaPlayback, [allow]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setAllowsInlineMediaPlayback, [allow]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future setLimitsNavigationsToAppBoundDomains(bool? limit) => (super.noSuchMethod( - Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setLimitsNavigationsToAppBoundDomains, [limit]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future setMediaTypesRequiringUserActionForPlayback( _i2.AudiovisualMediaType? type, ) => (super.noSuchMethod( - Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ - type, - ]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + Invocation.method(#setMediaTypesRequiringUserActionForPlayback, [ + type, + ]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); @override _i3.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( + Invocation.method(#getDefaultWebpagePreferences, []), + returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( + _FakeWKWebpagePreferences_5( + this, Invocation.method(#getDefaultWebpagePreferences, []), - returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_5( - this, - Invocation.method(#getDefaultWebpagePreferences, []), - ), - ), - ) - as _i3.Future<_i2.WKWebpagePreferences>); + ), + ), + ) as _i3.Future<_i2.WKWebpagePreferences>); @override - _i2.WKWebViewConfiguration pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebViewConfiguration_6( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.WKWebViewConfiguration); + _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeWKWebViewConfiguration_6( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.WKWebViewConfiguration); @override _i3.Future addObserver( @@ -326,20 +299,18 @@ class MockWKWebViewConfiguration extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } /// A class which mocks [UIScrollViewDelegate]. @@ -352,26 +323,22 @@ class MockUIScrollViewDelegate extends _i1.Mock } @override - _i2.PigeonInstanceManager get pigeon_instanceManager => - (super.noSuchMethod( - Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_0( - this, - Invocation.getter(#pigeon_instanceManager), - ), - ) - as _i2.PigeonInstanceManager); + _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( + Invocation.getter(#pigeon_instanceManager), + returnValue: _FakePigeonInstanceManager_0( + this, + Invocation.getter(#pigeon_instanceManager), + ), + ) as _i2.PigeonInstanceManager); @override - _i2.UIScrollViewDelegate pigeon_copy() => - (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeUIScrollViewDelegate_7( - this, - Invocation.method(#pigeon_copy, []), - ), - ) - as _i2.UIScrollViewDelegate); + _i2.UIScrollViewDelegate pigeon_copy() => (super.noSuchMethod( + Invocation.method(#pigeon_copy, []), + returnValue: _FakeUIScrollViewDelegate_7( + this, + Invocation.method(#pigeon_copy, []), + ), + ) as _i2.UIScrollViewDelegate); @override _i3.Future addObserver( @@ -380,18 +347,16 @@ class MockUIScrollViewDelegate extends _i1.Mock List<_i2.KeyValueObservingOptions>? options, ) => (super.noSuchMethod( - Invocation.method(#addObserver, [observer, keyPath, options]), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) - as _i3.Future); + 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); + Invocation.method(#removeObserver, [observer, keyPath]), + returnValue: _i3.Future.value(), + returnValueForMissingStub: _i3.Future.value(), + ) as _i3.Future); } From 6f24861154913f42b8ea26ef72d48a3b502ebe03 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 23:12:38 -0400 Subject: [PATCH 24/34] app facing tests --- .../lib/src/navigation_delegate.dart | 4 +-- .../test/navigation_delegate_test.dart | 30 +++++++++++++++++++ .../test/navigation_delegate_test.mocks.dart | 10 +++++++ .../test/webview_controller_test.mocks.dart | 10 +++++++ 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart index d93b1bbe981c..26a806c5bf8d 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart @@ -165,8 +165,8 @@ class NavigationDelegate { } if (onSslAuthError != null) { platform.setOnSSlAuthError( - (PlatformSslAuthError request) { - onSslAuthError(SslAuthError._fromPlatform(request)); + (PlatformSslAuthError error) { + onSslAuthError(SslAuthError._fromPlatform(error)); }, ); } diff --git a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart index 64f5b16170d5..8a174ca2c4cd 100644 --- a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.dart @@ -111,6 +111,22 @@ void main() { verify(delegate.platform.setOnHttpError(onHttpError)); }); + + test('onSslAuthError', () async { + WebViewPlatform.instance = TestWebViewPlatform(); + + final NavigationDelegate delegate = NavigationDelegate( + onSslAuthError: expectAsync1((_) {}), + ); + + final void Function(PlatformSslAuthError) callback = verify( + (delegate.platform as MockPlatformNavigationDelegate) + .setOnSSlAuthError(captureAny)) + .captured + .single as void Function(PlatformSslAuthError); + + callback(TestPlatformSslAuthError()); + }); }); } @@ -125,3 +141,17 @@ class TestWebViewPlatform extends WebViewPlatform { class TestMockPlatformNavigationDelegate extends MockPlatformNavigationDelegate with MockPlatformInterfaceMixin {} + +class TestPlatformSslAuthError extends PlatformSslAuthError { + TestPlatformSslAuthError() : super(certificate: null, description: ''); + + @override + Future cancel() { + throw UnimplementedError(); + } + + @override + Future proceed() { + throw UnimplementedError(); + } +} diff --git a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart index 4b02c37ace2a..90f8d338e45f 100644 --- a/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/navigation_delegate_test.mocks.dart @@ -211,4 +211,14 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i8.Future.value(), returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + + @override + _i8.Future setOnSSlAuthError( + _i3.SslAuthErrorCallback? onSslAuthError, + ) => + (super.noSuchMethod( + Invocation.method(#setOnSSlAuthError, [onSslAuthError]), + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) as _i8.Future); } diff --git a/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart index 0c4537103a5f..1bf14e9df61b 100644 --- a/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter/test/webview_controller_test.mocks.dart @@ -436,4 +436,14 @@ class MockPlatformNavigationDelegate extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + + @override + _i5.Future setOnSSlAuthError( + _i6.SslAuthErrorCallback? onSslAuthError, + ) => + (super.noSuchMethod( + Invocation.method(#setOnSSlAuthError, [onSslAuthError]), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } From d5e38794c48229ac4b4f8e9f2993411019043bc7 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 24 Apr 2025 23:20:05 -0400 Subject: [PATCH 25/34] lint and docs --- .../webview_flutter/lib/src/navigation_delegate.dart | 2 +- .../test/webkit_navigation_delegate_test.dart | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart index 26a806c5bf8d..215325e56fcb 100644 --- a/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter/lib/src/navigation_delegate.dart @@ -204,7 +204,7 @@ class NavigationDelegate { /// /// The host application must call [cancel] or, contrary to secure web /// communication standards, [proceed] to provide the web view's response to the -/// request. +/// error. /// /// ## Platform-Specific Features /// This class contains an underlying implementation provided by the current 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 fc649dd973de..56cb91b266f5 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 @@ -3,7 +3,6 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; From 1f3ec876bdba53f5bcc04a4d4598c2917dc0cd25 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:22:57 -0400 Subject: [PATCH 26/34] add ssl handler to android --- .../webview_flutter_android/example/lib/main.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart index 490e3d44f7ab..68e94173e059 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart @@ -201,6 +201,10 @@ Page resource error: }) ..setOnHttpAuthRequest((HttpAuthRequest request) { openDialog(request); + }) + ..setOnSSlAuthError((PlatformSslAuthError error) { + debugPrint('SSL error from ${(error as AndroidSslAuthError).url}'); + error.cancel(); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( From 1d727220c97554a9b7fda30bc6b16514c9e51fb7 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:58:26 -0400 Subject: [PATCH 27/34] update ios dart implementation --- .../WebKitLibrary.g.swift | 8965 +++++++++++------ .../example/lib/main.dart | 6 +- .../lib/src/common/web_kit.g.dart | 765 +- .../src/legacy/web_kit_webview_widget.dart | 10 +- .../lib/src/webkit_proxy.dart | 22 +- .../lib/src/webkit_ssl_auth_error.dart | 15 +- .../lib/src/webkit_webview_controller.dart | 39 +- .../pigeons/web_kit.dart | 51 +- .../webview_flutter_wkwebview/pubspec.yaml | 6 +- 9 files changed, 6483 insertions(+), 3396 deletions(-) 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 dbb88c1696ae..a58e32c238bb 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 @@ -6,9 +6,8 @@ import Foundation import WebKit - #if !os(macOS) - import UIKit +import UIKit #endif #if os(iOS) @@ -64,9 +63,7 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError( - code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", - details: "") + return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -84,6 +81,7 @@ protocol WebKitLibraryPigeonInternalFinalizerDelegate: AnyObject { func onDeinit(identifier: Int64) } + // Attaches to an object to receive a callback when the object is deallocated. internal final class WebKitLibraryPigeonInternalFinalizer { private static let associatedObjectKey = malloc(1)! @@ -99,8 +97,7 @@ internal final class WebKitLibraryPigeonInternalFinalizer { } internal static func attach( - to instance: AnyObject, identifier: Int64, - delegate: WebKitLibraryPigeonInternalFinalizerDelegate + to instance: AnyObject, identifier: Int64, delegate: WebKitLibraryPigeonInternalFinalizerDelegate ) { let finalizer = WebKitLibraryPigeonInternalFinalizer(identifier: identifier, delegate: delegate) objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) @@ -115,6 +112,7 @@ internal final class WebKitLibraryPigeonInternalFinalizer { } } + /// Maintains instances used to communicate with the corresponding objects in Dart. /// /// Objects stored in this container are represented by an object in Dart that is also stored in @@ -218,8 +216,7 @@ final class WebKitLibraryPigeonInstanceManager { identifiers.setObject(NSNumber(value: identifier), forKey: instance) weakInstances.setObject(instance, forKey: NSNumber(value: identifier)) strongInstances.setObject(instance, forKey: NSNumber(value: identifier)) - WebKitLibraryPigeonInternalFinalizer.attach( - to: instance, identifier: identifier, delegate: finalizerDelegate) + WebKitLibraryPigeonInternalFinalizer.attach(to: instance, identifier: identifier, delegate: finalizerDelegate) } /// Retrieves the identifier paired with an instance. @@ -296,6 +293,7 @@ final class WebKitLibraryPigeonInstanceManager { } } + private class WebKitLibraryPigeonInstanceManagerApi { /// The codec used for serializing messages. var codec: FlutterStandardMessageCodec { WebKitLibraryPigeonCodec.shared } @@ -308,14 +306,9 @@ private class WebKitLibraryPigeonInstanceManagerApi { } /// Sets up an instance of `WebKitLibraryPigeonInstanceManagerApi` to handle messages through the `binaryMessenger`. - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, instanceManager: WebKitLibraryPigeonInstanceManager? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, instanceManager: WebKitLibraryPigeonInstanceManager?) { let codec = WebKitLibraryPigeonCodec.shared - let removeStrongReferenceChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference", - binaryMessenger: binaryMessenger, codec: codec) + let removeStrongReferenceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference", binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { removeStrongReferenceChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -330,9 +323,7 @@ private class WebKitLibraryPigeonInstanceManagerApi { } else { removeStrongReferenceChannel.setMessageHandler(nil) } - let clearChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.clear", - binaryMessenger: binaryMessenger, codec: codec) + let clearChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.clear", binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { clearChannel.setMessageHandler { _, reply in do { @@ -348,13 +339,9 @@ private class WebKitLibraryPigeonInstanceManagerApi { } /// Sends a message to the Dart `InstanceManager` to remove the strong reference of the instance associated with `identifier`. - func removeStrongReference( - identifier identifierArg: Int64, completion: @escaping (Result) -> Void - ) { - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func removeStrongReference(identifier identifierArg: Int64, completion: @escaping (Result) -> Void) { + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([identifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -377,141 +364,111 @@ protocol WebKitLibraryPigeonProxyApiDelegate { func pigeonApiURLRequest(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLRequest /// An implementation of [PigeonApiHTTPURLResponse] used to add a new Dart instance of /// `HTTPURLResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiHTTPURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiHTTPURLResponse + func pigeonApiHTTPURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiHTTPURLResponse /// An implementation of [PigeonApiURLResponse] used to add a new Dart instance of /// `URLResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLResponse + func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLResponse /// An implementation of [PigeonApiWKUserScript] used to add a new Dart instance of /// `WKUserScript` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUserScript(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKUserScript + func pigeonApiWKUserScript(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUserScript /// An implementation of [PigeonApiWKNavigationAction] used to add a new Dart instance of /// `WKNavigationAction` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationAction(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKNavigationAction + func pigeonApiWKNavigationAction(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationAction /// An implementation of [PigeonApiWKNavigationResponse] used to add a new Dart instance of /// `WKNavigationResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKNavigationResponse + func pigeonApiWKNavigationResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationResponse /// An implementation of [PigeonApiWKFrameInfo] used to add a new Dart instance of /// `WKFrameInfo` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKFrameInfo(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKFrameInfo + func pigeonApiWKFrameInfo(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKFrameInfo /// An implementation of [PigeonApiNSError] used to add a new Dart instance of /// `NSError` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiNSError(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSError /// An implementation of [PigeonApiWKScriptMessage] used to add a new Dart instance of /// `WKScriptMessage` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKScriptMessage(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKScriptMessage + func pigeonApiWKScriptMessage(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKScriptMessage /// An implementation of [PigeonApiWKSecurityOrigin] used to add a new Dart instance of /// `WKSecurityOrigin` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKSecurityOrigin(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKSecurityOrigin + func pigeonApiWKSecurityOrigin(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKSecurityOrigin /// An implementation of [PigeonApiHTTPCookie] used to add a new Dart instance of /// `HTTPCookie` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiHTTPCookie(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiHTTPCookie /// An implementation of [PigeonApiAuthenticationChallengeResponse] used to add a new Dart instance of /// `AuthenticationChallengeResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiAuthenticationChallengeResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiAuthenticationChallengeResponse + func pigeonApiAuthenticationChallengeResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiAuthenticationChallengeResponse /// An implementation of [PigeonApiWKWebsiteDataStore] used to add a new Dart instance of /// `WKWebsiteDataStore` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKWebsiteDataStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKWebsiteDataStore + func pigeonApiWKWebsiteDataStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebsiteDataStore /// An implementation of [PigeonApiUIView] used to add a new Dart instance of /// `UIView` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiUIView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIView /// An implementation of [PigeonApiUIScrollView] used to add a new Dart instance of /// `UIScrollView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIScrollView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIScrollView + func pigeonApiUIScrollView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIScrollView /// An implementation of [PigeonApiWKWebViewConfiguration] used to add a new Dart instance of /// `WKWebViewConfiguration` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKWebViewConfiguration(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKWebViewConfiguration + func pigeonApiWKWebViewConfiguration(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebViewConfiguration /// An implementation of [PigeonApiWKUserContentController] used to add a new Dart instance of /// `WKUserContentController` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUserContentController(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKUserContentController + func pigeonApiWKUserContentController(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUserContentController /// An implementation of [PigeonApiWKPreferences] used to add a new Dart instance of /// `WKPreferences` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKPreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKPreferences + func pigeonApiWKPreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKPreferences /// An implementation of [PigeonApiWKScriptMessageHandler] used to add a new Dart instance of /// `WKScriptMessageHandler` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKScriptMessageHandler(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKScriptMessageHandler + func pigeonApiWKScriptMessageHandler(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKScriptMessageHandler /// An implementation of [PigeonApiWKNavigationDelegate] used to add a new Dart instance of /// `WKNavigationDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKNavigationDelegate + func pigeonApiWKNavigationDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationDelegate /// An implementation of [PigeonApiNSObject] used to add a new Dart instance of /// `NSObject` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiNSObject(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject /// An implementation of [PigeonApiUIViewWKWebView] used to add a new Dart instance of /// `UIViewWKWebView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIViewWKWebView + func pigeonApiUIViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIViewWKWebView /// An implementation of [PigeonApiNSViewWKWebView] used to add a new Dart instance of /// `NSViewWKWebView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiNSViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiNSViewWKWebView + func pigeonApiNSViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSViewWKWebView /// An implementation of [PigeonApiWKWebView] used to add a new Dart instance of /// `WKWebView` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebView /// An implementation of [PigeonApiWKUIDelegate] used to add a new Dart instance of /// `WKUIDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUIDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKUIDelegate + func pigeonApiWKUIDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUIDelegate /// An implementation of [PigeonApiWKHTTPCookieStore] used to add a new Dart instance of /// `WKHTTPCookieStore` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKHTTPCookieStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiWKHTTPCookieStore + func pigeonApiWKHTTPCookieStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKHTTPCookieStore /// An implementation of [PigeonApiUIScrollViewDelegate] used to add a new Dart instance of /// `UIScrollViewDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIScrollViewDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiUIScrollViewDelegate + func pigeonApiUIScrollViewDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIScrollViewDelegate /// An implementation of [PigeonApiURLCredential] used to add a new Dart instance of /// `URLCredential` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLCredential(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLCredential + func pigeonApiURLCredential(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLCredential /// An implementation of [PigeonApiURLProtectionSpace] used to add a new Dart instance of /// `URLProtectionSpace` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLProtectionSpace(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLProtectionSpace + func pigeonApiURLProtectionSpace(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLProtectionSpace /// An implementation of [PigeonApiURLAuthenticationChallenge] used to add a new Dart instance of /// `URLAuthenticationChallenge` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLAuthenticationChallenge(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLAuthenticationChallenge + func pigeonApiURLAuthenticationChallenge(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLAuthenticationChallenge /// 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 + func pigeonApiWKWebpagePreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebpagePreferences /// An implementation of [PigeonApiGetTrustResultResponse] used to add a new Dart instance of /// `GetTrustResultResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiGetTrustResultResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiGetTrustResultResponse + func pigeonApiGetTrustResultResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiGetTrustResultResponse /// An implementation of [PigeonApiSecTrust] used to add a new Dart instance of /// `SecTrust` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiSecTrust(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiSecTrust /// An implementation of [PigeonApiSecCertificate] used to add a new Dart instance of /// `SecCertificate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiSecCertificate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiSecCertificate + func pigeonApiSecCertificate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiSecCertificate } extension WebKitLibraryPigeonProxyApiDelegate { - func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) - -> PigeonApiURLResponse - { - return PigeonApiURLResponse( - pigeonRegistrar: registrar, delegate: PigeonApiDelegateURLResponse()) + func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLResponse { + return PigeonApiURLResponse(pigeonRegistrar: registrar, delegate: PigeonApiDelegateURLResponse()) } func pigeonApiWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebView { return PigeonApiWKWebView(pigeonRegistrar: registrar, delegate: PigeonApiDelegateWKWebView()) @@ -556,74 +513,44 @@ open class WebKitLibraryPigeonProxyApiRegistrar { } func setUp() { - WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: instanceManager) - PigeonApiURLRequest.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLRequest(self)) - PigeonApiWKUserScript.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserScript(self)) - PigeonApiHTTPCookie.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiHTTPCookie(self)) - PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers( - binaryMessenger: binaryMessenger, - api: apiDelegate.pigeonApiAuthenticationChallengeResponse(self)) - PigeonApiWKWebsiteDataStore.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebsiteDataStore(self)) - PigeonApiUIView.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(self)) - PigeonApiUIScrollView.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollView(self)) - PigeonApiWKWebViewConfiguration.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebViewConfiguration(self)) - PigeonApiWKUserContentController.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserContentController(self)) - PigeonApiWKPreferences.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKPreferences(self)) - PigeonApiWKScriptMessageHandler.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKScriptMessageHandler(self)) - PigeonApiWKNavigationDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKNavigationDelegate(self)) - PigeonApiNSObject.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSObject(self)) - PigeonApiUIViewWKWebView.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewWKWebView(self)) - PigeonApiNSViewWKWebView.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSViewWKWebView(self)) - PigeonApiWKUIDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUIDelegate(self)) - PigeonApiWKHTTPCookieStore.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKHTTPCookieStore(self)) - PigeonApiUIScrollViewDelegate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) - PigeonApiURLCredential.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) - PigeonApiURLProtectionSpace.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) - PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) - PigeonApiURL.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) - PigeonApiWKWebpagePreferences.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) - PigeonApiSecTrust.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecTrust(self)) - PigeonApiSecCertificate.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecCertificate(self)) + WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager) + PigeonApiURLRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLRequest(self)) + PigeonApiWKUserScript.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserScript(self)) + PigeonApiHTTPCookie.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiHTTPCookie(self)) + PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiAuthenticationChallengeResponse(self)) + PigeonApiWKWebsiteDataStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebsiteDataStore(self)) + PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(self)) + PigeonApiUIScrollView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollView(self)) + PigeonApiWKWebViewConfiguration.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebViewConfiguration(self)) + PigeonApiWKUserContentController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserContentController(self)) + PigeonApiWKPreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKPreferences(self)) + PigeonApiWKScriptMessageHandler.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKScriptMessageHandler(self)) + PigeonApiWKNavigationDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKNavigationDelegate(self)) + PigeonApiNSObject.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSObject(self)) + PigeonApiUIViewWKWebView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewWKWebView(self)) + PigeonApiNSViewWKWebView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSViewWKWebView(self)) + PigeonApiWKUIDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUIDelegate(self)) + PigeonApiWKHTTPCookieStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKHTTPCookieStore(self)) + PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) + PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) + PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) + PigeonApiURLAuthenticationChallenge.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) + PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) + PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) + PigeonApiSecTrust.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecTrust(self)) + PigeonApiSecCertificate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecCertificate(self)) } func tearDown() { - WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( - binaryMessenger: binaryMessenger, instanceManager: nil) + WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil) PigeonApiURLRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKUserScript.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiHTTPCookie.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: nil) + PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebsiteDataStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIScrollView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebViewConfiguration.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiWKUserContentController.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: nil) + PigeonApiWKUserContentController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKPreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKScriptMessageHandler.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKNavigationDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -635,8 +562,7 @@ open class WebKitLibraryPigeonProxyApiRegistrar { PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( - binaryMessenger: binaryMessenger, api: nil) + PigeonApiURLAuthenticationChallenge.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiSecTrust.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -679,272 +605,252 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand } override func writeValue(_ value: Any) { - if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] - || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String - || value is KeyValueObservingOptions || value is KeyValueChange - || value is KeyValueChangeKey || value is UserScriptInjectionTime - || value is AudiovisualMediaType || value is WebsiteDataType - || value is NavigationActionPolicy || value is NavigationResponsePolicy - || value is HttpCookiePropertyKey || value is NavigationType || value is PermissionDecision - || value is MediaCaptureType || value is UrlSessionAuthChallengeDisposition - || value is UrlCredentialPersistence || value is DartSecTrustResultType - { + if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String || value is KeyValueObservingOptions || value is KeyValueChange || value is KeyValueChangeKey || value is UserScriptInjectionTime || value is AudiovisualMediaType || value is WebsiteDataType || value is NavigationActionPolicy || value is NavigationResponsePolicy || value is HttpCookiePropertyKey || value is NavigationType || value is PermissionDecision || value is MediaCaptureType || value is UrlSessionAuthChallengeDisposition || value is UrlCredentialPersistence || value is DartSecTrustResultType { super.writeValue(value) return } + if let instance = value as? URLRequestWrapper { pigeonRegistrar.apiDelegate.pigeonApiURLRequest(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? HTTPURLResponse { pigeonRegistrar.apiDelegate.pigeonApiHTTPURLResponse(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? URLResponse { pigeonRegistrar.apiDelegate.pigeonApiURLResponse(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKUserScript { pigeonRegistrar.apiDelegate.pigeonApiWKUserScript(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKNavigationAction { pigeonRegistrar.apiDelegate.pigeonApiWKNavigationAction(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKNavigationResponse { - pigeonRegistrar.apiDelegate.pigeonApiWKNavigationResponse(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKNavigationResponse(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKFrameInfo { pigeonRegistrar.apiDelegate.pigeonApiWKFrameInfo(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? NSError { pigeonRegistrar.apiDelegate.pigeonApiNSError(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKScriptMessage { pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessage(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKSecurityOrigin { pigeonRegistrar.apiDelegate.pigeonApiWKSecurityOrigin(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? HTTPCookie { pigeonRegistrar.apiDelegate.pigeonApiHTTPCookie(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? AuthenticationChallengeResponse { - pigeonRegistrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKWebsiteDataStore { pigeonRegistrar.apiDelegate.pigeonApiWKWebsiteDataStore(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? UIScrollView { - pigeonRegistrar.apiDelegate.pigeonApiUIScrollView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIScrollView { + pigeonRegistrar.apiDelegate.pigeonApiUIScrollView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? WKWebViewConfiguration { - pigeonRegistrar.apiDelegate.pigeonApiWKWebViewConfiguration(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKWebViewConfiguration(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKUserContentController { - pigeonRegistrar.apiDelegate.pigeonApiWKUserContentController(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKUserContentController(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKPreferences { pigeonRegistrar.apiDelegate.pigeonApiWKPreferences(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKScriptMessageHandler { - pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessageHandler(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessageHandler(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKNavigationDelegate { - pigeonRegistrar.apiDelegate.pigeonApiWKNavigationDelegate(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKNavigationDelegate(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? WKWebView { - pigeonRegistrar.apiDelegate.pigeonApiUIViewWKWebView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? WKWebView { + pigeonRegistrar.apiDelegate.pigeonApiUIViewWKWebView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif #if !os(macOS) - if let instance = value as? UIView { - pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIView { + pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif #if !os(iOS) - if let instance = value as? WKWebView { - pigeonRegistrar.apiDelegate.pigeonApiNSViewWKWebView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? WKWebView { + pigeonRegistrar.apiDelegate.pigeonApiNSViewWKWebView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? WKWebView { @@ -953,45 +859,42 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKUIDelegate { pigeonRegistrar.apiDelegate.pigeonApiWKUIDelegate(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? WKHTTPCookieStore { pigeonRegistrar.apiDelegate.pigeonApiWKHTTPCookieStore(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? UIScrollViewDelegate { - pigeonRegistrar.apiDelegate.pigeonApiUIScrollViewDelegate(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIScrollViewDelegate { + pigeonRegistrar.apiDelegate.pigeonApiUIScrollViewDelegate(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? URLCredential { @@ -1000,104 +903,100 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? URLProtectionSpace { pigeonRegistrar.apiDelegate.pigeonApiURLProtectionSpace(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? URLAuthenticationChallenge { - pigeonRegistrar.apiDelegate.pigeonApiURLAuthenticationChallenge(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiURLAuthenticationChallenge(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? URL { pigeonRegistrar.apiDelegate.pigeonApiURL(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if #available(iOS 13.0.0, macOS 10.15.0, *), let instance = value as? WKWebpagePreferences { - pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? GetTrustResultResponse { - pigeonRegistrar.apiDelegate.pigeonApiGetTrustResultResponse(pigeonRegistrar) - .pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiGetTrustResultResponse(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? SecTrustWrapper { pigeonRegistrar.apiDelegate.pigeonApiSecTrust(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? SecCertificateWrapper { pigeonRegistrar.apiDelegate.pigeonApiSecCertificate(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } + if let instance = value as? NSObject { pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference( - forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) return } - if let instance = value as AnyObject?, - pigeonRegistrar.instanceManager.containsInstance(instance) + + if let instance = value as AnyObject?, pigeonRegistrar.instanceManager.containsInstance(instance) { super.writeByte(128) super.writeValue( @@ -1115,13 +1014,11 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand } override func reader(with data: Data) -> FlutterStandardReader { - return WebKitLibraryPigeonInternalProxyApiCodecReader( - data: data, pigeonRegistrar: pigeonRegistrar) + return WebKitLibraryPigeonInternalProxyApiCodecReader(data: data, pigeonRegistrar: pigeonRegistrar) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return WebKitLibraryPigeonInternalProxyApiCodecWriter( - data: data, pigeonRegistrar: pigeonRegistrar) + return WebKitLibraryPigeonInternalProxyApiCodecWriter(data: data, pigeonRegistrar: pigeonRegistrar) } } @@ -1582,36 +1479,27 @@ class WebKitLibraryPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable } protocol PigeonApiDelegateURLRequest { - func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws - -> URLRequestWrapper + func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws -> URLRequestWrapper /// The URL being requested. func getUrl(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? /// The HTTP request method. - func setHttpMethod( - pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws + func setHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws /// The HTTP request method. - func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws - -> String? + func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? /// The request body. - func setHttpBody( - pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, - body: FlutterStandardTypedData?) throws + func setHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, body: FlutterStandardTypedData?) throws /// The request body. - func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws - -> FlutterStandardTypedData? + func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> FlutterStandardTypedData? /// A dictionary containing all of the HTTP header fields for a request. - func setAllHttpHeaderFields( - pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) - throws + func setAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) throws /// A dictionary containing all of the HTTP header fields for a request. - func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) - throws -> [String: String]? + func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> [String: String]? } protocol PigeonApiProtocolURLRequest { } -final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { +final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLRequest ///An implementation of [NSObject] used to access callback methods @@ -1619,23 +1507,17 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLRequest) - { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLRequest) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLRequest? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLRequest?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1643,8 +1525,8 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { let urlArg = args[1] as! String do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: urlArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: urlArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1653,16 +1535,13 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let getUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getUrl", - binaryMessenger: binaryMessenger, codec: codec) + let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getUrl", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getUrlChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1671,17 +1550,14 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { getUrlChannel.setMessageHandler(nil) } - let setHttpMethodChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpMethod", - binaryMessenger: binaryMessenger, codec: codec) + let setHttpMethodChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpMethod", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setHttpMethodChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let methodArg: String? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setHttpMethod( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, method: methodArg) + try api.pigeonDelegate.setHttpMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg, method: methodArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1690,16 +1566,13 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { setHttpMethodChannel.setMessageHandler(nil) } - let getHttpMethodChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpMethod", - binaryMessenger: binaryMessenger, codec: codec) + let getHttpMethodChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpMethod", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHttpMethodChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getHttpMethod( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getHttpMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1708,17 +1581,14 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { getHttpMethodChannel.setMessageHandler(nil) } - let setHttpBodyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpBody", - binaryMessenger: binaryMessenger, codec: codec) + let setHttpBodyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpBody", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setHttpBodyChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let bodyArg: FlutterStandardTypedData? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setHttpBody( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, body: bodyArg) + try api.pigeonDelegate.setHttpBody(pigeonApi: api, pigeonInstance: pigeonInstanceArg, body: bodyArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1727,16 +1597,13 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { setHttpBodyChannel.setMessageHandler(nil) } - let getHttpBodyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpBody", - binaryMessenger: binaryMessenger, codec: codec) + let getHttpBodyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpBody", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHttpBodyChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getHttpBody( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getHttpBody(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1745,17 +1612,14 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { getHttpBodyChannel.setMessageHandler(nil) } - let setAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setAllHttpHeaderFields", - binaryMessenger: binaryMessenger, codec: codec) + let setAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setAllHttpHeaderFields", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAllHttpHeaderFieldsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let fieldsArg: [String: String]? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setAllHttpHeaderFields( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, fields: fieldsArg) + try api.pigeonDelegate.setAllHttpHeaderFields(pigeonApi: api, pigeonInstance: pigeonInstanceArg, fields: fieldsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1764,16 +1628,13 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } else { setAllHttpHeaderFieldsChannel.setMessageHandler(nil) } - let getAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getAllHttpHeaderFields", - binaryMessenger: binaryMessenger, codec: codec) + let getAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getAllHttpHeaderFields", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAllHttpHeaderFieldsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getAllHttpHeaderFields( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAllHttpHeaderFields(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1785,26 +1646,21 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } ///Creates a Dart instance of URLRequest and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLRequestWrapper, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLRequestWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -1822,16 +1678,197 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URLRequest`. +/// +/// 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 URLRequestWrapperProxyAPIDelegate : PigeonApiDelegateURLRequest { + func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws -> URLRequestWrapper { + return URLRequest(,url: url) + } + + func getUrl(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? { + return pigeonInstance.url + } + + func setHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws { + pigeonInstance.httpMethod = method: method + } + + func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? { + return pigeonInstance.httpMethod + } + + func setHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, body: FlutterStandardTypedData?) throws { + pigeonInstance.httpBody = body: body + } + + func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> FlutterStandardTypedData? { + return pigeonInstance.httpBody + } + + func setAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) throws { + pigeonInstance.allHttpHeaderFields = fields: fields + } + + func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> [String: String]? { + return pigeonInstance.allHttpHeaderFields + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLRequestWrapperProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: "myString") + XCTAssertNotNil(instance) + } + + func testGetUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getUrlCalled) + XCTAssertEqual(value, instance.getUrl()) + } + + func testSetHttpMethod() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let method = "myString" + api.pigeonDelegate.setHttpMethod(pigeonApi: api, pigeonInstance: instance, method: method) + + XCTAssertEqual(instance.setHttpMethodArgs, [method]) + } + + func testGetHttpMethod() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let value = api.pigeonDelegate.getHttpMethod(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getHttpMethodCalled) + XCTAssertEqual(value, instance.getHttpMethod()) + } + + func testSetHttpBody() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let body = byteArrayOf(0xA1.toByte()) + api.pigeonDelegate.setHttpBody(pigeonApi: api, pigeonInstance: instance, body: body) + + XCTAssertEqual(instance.setHttpBodyArgs, [body]) + } + + func testGetHttpBody() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let value = api.pigeonDelegate.getHttpBody(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getHttpBodyCalled) + XCTAssertEqual(value, instance.getHttpBody()) + } + + func testSetAllHttpHeaderFields() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let fields = ["myString": "myString"] + api.pigeonDelegate.setAllHttpHeaderFields(pigeonApi: api, pigeonInstance: instance, fields: fields) + + XCTAssertEqual(instance.setAllHttpHeaderFieldsArgs, [fields]) + } + + func testGetAllHttpHeaderFields() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) + + let instance = TestURLRequestWrapper() + let value = api.pigeonDelegate.getAllHttpHeaderFields(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getAllHttpHeaderFieldsCalled) + XCTAssertEqual(value, instance.getAllHttpHeaderFields()) + } + +} +class TestURLRequestWrapper: URLRequest { + var getUrlCalled = false + var setHttpMethodArgs: [AnyHashable?]? = nil + var getHttpMethodCalled = false + var setHttpBodyArgs: [AnyHashable?]? = nil + var getHttpBodyCalled = false + var setAllHttpHeaderFieldsArgs: [AnyHashable?]? = nil + var getAllHttpHeaderFieldsCalled = false + + + override func getUrl() { + getUrlCalled = true + } + override func setHttpMethod() { + setHttpMethodArgs = [method] + } + override func getHttpMethod() { + getHttpMethodCalled = true + } + override func setHttpBody() { + setHttpBodyArgs = [body] + } + override func getHttpBody() { + getHttpBodyCalled = true + } + override func setAllHttpHeaderFields() { + setAllHttpHeaderFieldsArgs = [fields] + } + override func getAllHttpHeaderFields() { + getAllHttpHeaderFieldsCalled = true + } +} +*/ + protocol PigeonApiDelegateHTTPURLResponse { /// The response’s HTTP status code. - func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws - -> Int64 + func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 } protocol PigeonApiProtocolHTTPURLResponse { } -final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { +final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateHTTPURLResponse ///An implementation of [URLResponse] used to access callback methods @@ -1839,36 +1876,27 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { return pigeonRegistrar.apiDelegate.pigeonApiURLResponse(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateHTTPURLResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPURLResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of HTTPURLResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: HTTPURLResponse, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: HTTPURLResponse, 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) { + } 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) + } 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) + 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))) @@ -1886,13 +1914,60 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `HTTPURLResponse`. +/// +/// 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 HTTPURLResponseProxyAPIDelegate : PigeonApiDelegateHTTPURLResponse { + func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 { + return pigeonInstance.statusCode + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class HTTPURLResponseProxyAPITests: XCTestCase { + func testStatusCode() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiHTTPURLResponse(registrar) + + let instance = TestHTTPURLResponse() + let value = try? api.pigeonDelegate.statusCode(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.statusCode) + } + +} +*/ + open class PigeonApiDelegateURLResponse { } protocol PigeonApiProtocolURLResponse { } -final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { +final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLResponse ///An implementation of [NSObject] used to access callback methods @@ -1900,33 +1975,26 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of URLResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLResponse, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLResponse, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -1947,25 +2015,20 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { protocol PigeonApiDelegateWKUserScript { /// Creates a user script object that contains the specified source code and /// attributes. - func pigeonDefaultConstructor( - pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, - isForMainFrameOnly: Bool - ) throws -> WKUserScript + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, isForMainFrameOnly: Bool) throws -> WKUserScript /// The script’s source code. func source(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> String /// The time at which to inject the script into the webpage. - func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws - -> UserScriptInjectionTime + func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> UserScriptInjectionTime /// A Boolean value that indicates whether to inject the script into the main /// frame or all frames. - func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws - -> Bool + func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> Bool } protocol PigeonApiProtocolWKUserScript { } -final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { +final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUserScript ///An implementation of [NSObject] used to access callback methods @@ -1973,24 +2036,17 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserScript - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserScript) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserScript? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserScript?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2000,10 +2056,8 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { let isForMainFrameOnlyArg = args[3] as! Bool do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, source: sourceArg, injectionTime: injectionTimeArg, - isForMainFrameOnly: isForMainFrameOnlyArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, source: sourceArg, injectionTime: injectionTimeArg, isForMainFrameOnly: isForMainFrameOnlyArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2015,34 +2069,25 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { } ///Creates a Dart instance of WKUserScript and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKUserScript, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKUserScript, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2059,72 +2104,151 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { } } } -protocol PigeonApiDelegateWKNavigationAction { - /// The URL request object associated with the navigation action. - func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws - -> URLRequestWrapper - /// The frame in which to display the new content. - /// - /// If the target of the navigation is a new window, this property is nil. - func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) - throws -> WKFrameInfo? - /// The type of action that triggered the navigation. - func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) - throws -> NavigationType -} -protocol PigeonApiProtocolWKNavigationAction { -} +/* +// 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. -final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { - unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateWKNavigationAction - ///An implementation of [NSObject] used to access callback methods - var pigeonApiNSObject: PigeonApiNSObject { - return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) +import Foundation +import WebKit + + +/// ProxyApi implementation for `WKUserScript`. +/// +/// 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 UserScriptProxyAPIDelegate : PigeonApiDelegateWKUserScript { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, isForMainFrameOnly: Bool) throws -> WKUserScript { + return WKUserScript() } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKNavigationAction - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate + func source(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> String { + return pigeonInstance.source } - ///Creates a Dart instance of WKNavigationAction and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKNavigationAction, 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 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 { + + func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> UserScriptInjectionTime { + switch pigeonInstance.injectionTime { + case .atDocumentStart: + return .atDocumentStart + case .atDocumentEnd: + return .atDocumentEnd + @unknown default: + return .unknown + } + } + + func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> Bool { + return pigeonInstance.isForMainFrameOnly + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class UserScriptProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api source: "myString", injectionTime: .atDocumentStart, isForMainFrameOnly: true) + XCTAssertNotNil(instance) + } + + func testSource() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) + + let instance = TestUserScript() + let value = try? api.pigeonDelegate.source(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.source) + } + + func testInjectionTime() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) + + let instance = TestUserScript() + let value = try? api.pigeonDelegate.injectionTime(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.injectionTime) + } + + func testIsForMainFrameOnly() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) + + let instance = TestUserScript() + let value = try? api.pigeonDelegate.isForMainFrameOnly(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.isForMainFrameOnly) + } + +} +*/ + +protocol PigeonApiDelegateWKNavigationAction { + /// The URL request object associated with the navigation action. + func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper + /// The frame in which to display the new content. + /// + /// If the target of the navigation is a new window, this property is nil. + func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> WKFrameInfo? + /// The type of action that triggered the navigation. + func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> NavigationType +} + +protocol PigeonApiProtocolWKNavigationAction { +} + +final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { + unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar + let pigeonDelegate: PigeonApiDelegateWKNavigationAction + ///An implementation of [NSObject] used to access callback methods + var pigeonApiNSObject: PigeonApiNSObject { + return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) + } + + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationAction) { + self.pigeonRegistrar = pigeonRegistrar + self.pigeonDelegate = delegate + } + ///Creates a Dart instance of WKNavigationAction and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKNavigationAction, 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 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]) @@ -2136,21 +2260,108 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKNavigationAction`. +/// +/// 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 NavigationActionProxyAPIDelegate : PigeonApiDelegateWKNavigationAction { + func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper { + return pigeonInstance.request + } + + func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> WKFrameInfo? { + return pigeonInstance.targetFrame + } + + func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> NavigationType { + switch pigeonInstance.navigationType { + case .linkActivated: + return .linkActivated + case .formSubmitted: + return .formSubmitted + case .backForward: + return .backForward + case .reload: + return .reload + case .formResubmitted: + return .formResubmitted + case .other: + return .other + @unknown default: + return .unknown + } + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class NavigationActionProxyAPITests: XCTestCase { + func testRequest() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) + + let instance = TestNavigationAction() + let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.request) + } + + func testTargetFrame() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) + + let instance = TestNavigationAction() + let value = try? api.pigeonDelegate.targetFrame(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.targetFrame) + } + + func testNavigationType() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) + + let instance = TestNavigationAction() + let value = try? api.pigeonDelegate.navigationType(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.navigationType) + } + +} +*/ + protocol PigeonApiDelegateWKNavigationResponse { /// The frame’s response. - func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) - throws -> URLResponse + func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse /// A Boolean value that indicates whether the response targets the web view’s /// main frame. - func isForMainFrame( - pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse - ) throws -> Bool + func isForMainFrame(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> Bool } protocol PigeonApiProtocolWKNavigationResponse { } -final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse { +final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationResponse ///An implementation of [NSObject] used to access callback methods @@ -2158,40 +2369,29 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKNavigationResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKNavigationResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKNavigationResponse, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKNavigationResponse, 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) { + } 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) + } 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 + 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 @@ -2208,19 +2408,79 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKNavigationResponse`. +/// +/// 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 NavigationResponseProxyAPIDelegate : PigeonApiDelegateWKNavigationResponse { + func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse { + return pigeonInstance.response + } + + func isForMainFrame(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> Bool { + return pigeonInstance.isForMainFrame + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class NavigationResponseProxyAPITests: XCTestCase { + func testResponse() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationResponse(registrar) + + let instance = TestNavigationResponse() + let value = try? api.pigeonDelegate.response(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.response) + } + + func testIsForMainFrame() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationResponse(registrar) + + let instance = TestNavigationResponse() + let value = try? api.pigeonDelegate.isForMainFrame(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.isForMainFrame) + } + +} +*/ + protocol PigeonApiDelegateWKFrameInfo { /// A Boolean value indicating whether the frame is the web site's main frame /// or a subframe. func isMainFrame(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> Bool /// The frame’s current request. - func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws - -> URLRequestWrapper? + func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> URLRequestWrapper? } protocol PigeonApiProtocolWKFrameInfo { } -final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { +final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKFrameInfo ///An implementation of [NSObject] used to access callback methods @@ -2228,36 +2488,28 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKFrameInfo - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKFrameInfo) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKFrameInfo and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKFrameInfo, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKFrameInfo, 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) { + } 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) + } 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) + 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))) @@ -2275,6 +2527,67 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKFrameInfo`. +/// +/// 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 FrameInfoProxyAPIDelegate : PigeonApiDelegateWKFrameInfo { + func isMainFrame(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> Bool { + return pigeonInstance.isMainFrame + } + + func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> URLRequestWrapper? { + return pigeonInstance.request + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class FrameInfoProxyAPITests: XCTestCase { + func testIsMainFrame() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) + + let instance = TestFrameInfo() + let value = try? api.pigeonDelegate.isMainFrame(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.isMainFrame) + } + + func testRequest() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) + + let instance = TestFrameInfo() + let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.request) + } + +} +*/ + protocol PigeonApiDelegateNSError { /// The error code. func code(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> Int64 @@ -2287,7 +2600,7 @@ protocol PigeonApiDelegateNSError { protocol PigeonApiProtocolNSError { } -final class PigeonApiNSError: PigeonApiProtocolNSError { +final class PigeonApiNSError: PigeonApiProtocolNSError { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSError ///An implementation of [NSObject] used to access callback methods @@ -2300,32 +2613,25 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { self.pigeonDelegate = delegate } ///Creates a Dart instance of NSError and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: NSError, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: NSError, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2342,6 +2648,81 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `NSError`. +/// +/// 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 ErrorProxyAPIDelegate : PigeonApiDelegateNSError { + func code(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> Int64 { + return pigeonInstance.code + } + + func domain(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> String { + return pigeonInstance.domain + } + + func userInfo(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> [String: Any?] { + return pigeonInstance.userInfo + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ErrorProxyAPITests: XCTestCase { + func testCode() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSError(registrar) + + let instance = TestError() + let value = try? api.pigeonDelegate.code(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.code) + } + + func testDomain() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSError(registrar) + + let instance = TestError() + let value = try? api.pigeonDelegate.domain(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.domain) + } + + func testUserInfo() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSError(registrar) + + let instance = TestError() + let value = try? api.pigeonDelegate.userInfo(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.userInfo) + } + +} +*/ + protocol PigeonApiDelegateWKScriptMessage { /// The name of the message handler to which the message is sent. func name(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> String @@ -2352,7 +2733,7 @@ protocol PigeonApiDelegateWKScriptMessage { protocol PigeonApiProtocolWKScriptMessage { } -final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { +final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKScriptMessage ///An implementation of [NSObject] used to access callback methods @@ -2360,36 +2741,28 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKScriptMessage - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKScriptMessage) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKScriptMessage and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKScriptMessage, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKScriptMessage, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -2407,61 +2780,111 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { } } } -protocol PigeonApiDelegateWKSecurityOrigin { - /// The security origin’s host. - func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String - /// The security origin's port. - func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 - /// The security origin's protocol. - func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) - throws -> String -} -protocol PigeonApiProtocolWKSecurityOrigin { -} +/* +// 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. -final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { - unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar - let pigeonDelegate: PigeonApiDelegateWKSecurityOrigin - ///An implementation of [NSObject] used to access callback methods - var pigeonApiNSObject: PigeonApiNSObject { - return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) +import Foundation +import WebKit + + +/// ProxyApi implementation for `WKScriptMessage`. +/// +/// 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 ScriptMessageProxyAPIDelegate : PigeonApiDelegateWKScriptMessage { + func name(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> String { + return pigeonInstance.name } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKSecurityOrigin - ) { - self.pigeonRegistrar = pigeonRegistrar - self.pigeonDelegate = delegate + func body(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> Any? { + return pigeonInstance.body } - ///Creates a Dart instance of WKSecurityOrigin and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKSecurityOrigin, completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ScriptMessageProxyAPITests: XCTestCase { + func testName() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKScriptMessage(registrar) + + let instance = TestScriptMessage() + let value = try? api.pigeonDelegate.name(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.name) + } + + func testBody() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKScriptMessage(registrar) + + let instance = TestScriptMessage() + let value = try? api.pigeonDelegate.body(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.body) + } + +} +*/ + +protocol PigeonApiDelegateWKSecurityOrigin { + /// The security origin’s host. + func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String + /// The security origin's port. + func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 + /// The security origin's protocol. + func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String +} + +protocol PigeonApiProtocolWKSecurityOrigin { +} + +final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { + unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar + let pigeonDelegate: PigeonApiDelegateWKSecurityOrigin + ///An implementation of [NSObject] used to access callback methods + var pigeonApiNSObject: PigeonApiNSObject { + return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) + } + + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKSecurityOrigin) { + self.pigeonRegistrar = pigeonRegistrar + self.pigeonDelegate = delegate + } + ///Creates a Dart instance of WKSecurityOrigin and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKSecurityOrigin, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2478,19 +2901,91 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKSecurityOrigin`. +/// +/// 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 SecurityOriginProxyAPIDelegate : PigeonApiDelegateWKSecurityOrigin { + func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String { + return pigeonInstance.host + } + + func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 { + return pigeonInstance.port + } + + func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String { + return pigeonInstance.securityProtocol + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class SecurityOriginProxyAPITests: XCTestCase { + func testHost() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) + + let instance = TestSecurityOrigin() + let value = try? api.pigeonDelegate.host(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.host) + } + + func testPort() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) + + let instance = TestSecurityOrigin() + let value = try? api.pigeonDelegate.port(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.port) + } + + func testSecurityProtocol() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) + + let instance = TestSecurityOrigin() + let value = try? api.pigeonDelegate.securityProtocol(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.securityProtocol) + } + +} +*/ + protocol PigeonApiDelegateHTTPCookie { - func pigeonDefaultConstructor( - pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any] - ) throws -> HTTPCookie + func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie /// The cookie’s properties. - func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws - -> [HttpCookiePropertyKey: Any]? + func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws -> [HttpCookiePropertyKey: Any]? } protocol PigeonApiProtocolHTTPCookie { } -final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { +final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateHTTPCookie ///An implementation of [NSObject] used to access callback methods @@ -2498,23 +2993,17 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPCookie) - { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPCookie) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiHTTPCookie? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiHTTPCookie?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2522,9 +3011,8 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { let propertiesArg = args[1] as? [HttpCookiePropertyKey: Any] do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, properties: propertiesArg!), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, properties: propertiesArg!), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2533,16 +3021,13 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let getPropertiesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.getProperties", - binaryMessenger: binaryMessenger, codec: codec) + let getPropertiesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.getProperties", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getPropertiesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! HTTPCookie do { - let result = try api.pigeonDelegate.getProperties( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getProperties(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -2554,26 +3039,21 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { } ///Creates a Dart instance of HTTPCookie and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: HTTPCookie, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: HTTPCookie, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -2591,52 +3071,106 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `HTTPCookie`. +/// +/// 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 HTTPCookieProxyAPIDelegate : PigeonApiDelegateHTTPCookie { + func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie { + return HTTPCookie(,properties: properties) + } + + func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws -> [HttpCookiePropertyKey: Any]? { + return pigeonInstance.properties + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class HTTPCookieProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiHTTPCookie(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, properties: [.comment: -1]) + XCTAssertNotNil(instance) + } + + func testGetProperties() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiHTTPCookie(registrar) + + let instance = TestHTTPCookie() + let value = api.pigeonDelegate.getProperties(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getPropertiesCalled) + XCTAssertEqual(value, instance.getProperties()) + } + +} +class TestHTTPCookie: HTTPCookie { + var getPropertiesCalled = false + + + override func getProperties() { + getPropertiesCalled = true + } +} +*/ + protocol PigeonApiDelegateAuthenticationChallengeResponse { - func pigeonDefaultConstructor( - pigeonApi: PigeonApiAuthenticationChallengeResponse, - disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential? - ) throws -> AuthenticationChallengeResponse + func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse /// The option to use to handle the challenge. - func disposition( - pigeonApi: PigeonApiAuthenticationChallengeResponse, - pigeonInstance: AuthenticationChallengeResponse - ) throws -> UrlSessionAuthChallengeDisposition + func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition /// The credential to use for authentication when the disposition parameter /// contains the value URLSession.AuthChallengeDisposition.useCredential. - func credential( - pigeonApi: PigeonApiAuthenticationChallengeResponse, - pigeonInstance: AuthenticationChallengeResponse - ) throws -> URLCredential? + func credential(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> URLCredential? + /// Creates an [AuthenticationChallengeResponse] + /// + /// This provides the native `AuthenticationChallengeResponse()` constructor + /// as an async method to ensure the class is added to the InstanceManager. + /// See https://github.com/flutter/flutter/issues/162437. + func createAsync(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolAuthenticationChallengeResponse { } -final class PigeonApiAuthenticationChallengeResponse: - PigeonApiProtocolAuthenticationChallengeResponse -{ +final class PigeonApiAuthenticationChallengeResponse: PigeonApiProtocolAuthenticationChallengeResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateAuthenticationChallengeResponse - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateAuthenticationChallengeResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateAuthenticationChallengeResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiAuthenticationChallengeResponse? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiAuthenticationChallengeResponse?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2645,9 +3179,8 @@ final class PigeonApiAuthenticationChallengeResponse: let credentialArg: URLCredential? = nilOrValue(args[2]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, disposition: dispositionArg, credential: credentialArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, disposition: dispositionArg, credential: credentialArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2656,36 +3189,45 @@ final class PigeonApiAuthenticationChallengeResponse: } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } + let createAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.createAsync", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + createAsyncChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let dispositionArg = args[0] as! UrlSessionAuthChallengeDisposition + let credentialArg: URLCredential? = nilOrValue(args[1]) + api.pigeonDelegate.createAsync(pigeonApi: api, disposition: dispositionArg, credential: credentialArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + createAsyncChannel.setMessageHandler(nil) + } } ///Creates a Dart instance of AuthenticationChallengeResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: AuthenticationChallengeResponse, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: AuthenticationChallengeResponse, 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) { + } 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) + } 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 + 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 @@ -2702,23 +3244,107 @@ final class PigeonApiAuthenticationChallengeResponse: } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `AuthenticationChallengeResponse`. +/// +/// 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 AuthenticationChallengeResponseProxyAPIDelegate : PigeonApiDelegateAuthenticationChallengeResponse { + func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse { + return AuthenticationChallengeResponse() + } + + func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition { + switch pigeonInstance.disposition { + case .useCredential: + return .useCredential + case .performDefaultHandling: + return .performDefaultHandling + case .cancelAuthenticationChallenge: + return .cancelAuthenticationChallenge + case .rejectProtectionSpace: + return .rejectProtectionSpace + @unknown default: + return .unknown + } + } + + func credential(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> URLCredential? { + return pigeonInstance.credential + } + + func createAsync(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, completion: @escaping (Result) -> Void) { + return AuthenticationChallengeResponse.createAsync(disposition: disposition, credential: credential) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class AuthenticationChallengeResponseProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api disposition: .useCredential, credential: TestURLCredential) + XCTAssertNotNil(instance) + } + + func testDisposition() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) + + let instance = TestAuthenticationChallengeResponse() + let value = try? api.pigeonDelegate.disposition(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.disposition) + } + + func testCredential() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) + + let instance = TestAuthenticationChallengeResponse() + let value = try? api.pigeonDelegate.credential(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.credential) + } + +} +*/ + protocol PigeonApiDelegateWKWebsiteDataStore { /// The default data store, which stores data persistently to disk. func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore) throws -> WKWebsiteDataStore /// The object that manages the HTTP cookies for your website. - func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore) - throws -> WKHTTPCookieStore + func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore) throws -> WKHTTPCookieStore /// Removes the specified types of website data from one or more data records. - func removeDataOfTypes( - pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, - dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, - completion: @escaping (Result) -> Void) + func removeDataOfTypes(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolWKWebsiteDataStore { } -final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { +final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebsiteDataStore ///An implementation of [NSObject] used to access callback methods @@ -2726,33 +3352,23 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKWebsiteDataStore - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebsiteDataStore) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebsiteDataStore? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebsiteDataStore?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let defaultDataStoreChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.defaultDataStore", - binaryMessenger: binaryMessenger, codec: codec) + let defaultDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.defaultDataStore", binaryMessenger: binaryMessenger, codec: codec) if let api = api { defaultDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.defaultDataStore(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.defaultDataStore(pigeonApi: api), withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2761,19 +3377,14 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } else { defaultDataStoreChannel.setMessageHandler(nil) } - let httpCookieStoreChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.httpCookieStore", - binaryMessenger: binaryMessenger, codec: codec) + let httpCookieStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.httpCookieStore", binaryMessenger: binaryMessenger, codec: codec) if let api = api { httpCookieStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebsiteDataStore let pigeonIdentifierArg = args[1] as! Int64 do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.httpCookieStore( - pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.httpCookieStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2782,19 +3393,14 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } else { httpCookieStoreChannel.setMessageHandler(nil) } - let removeDataOfTypesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.removeDataOfTypes", - binaryMessenger: binaryMessenger, codec: codec) + let removeDataOfTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.removeDataOfTypes", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeDataOfTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebsiteDataStore let dataTypesArg = args[1] as! [WebsiteDataType] let modificationTimeInSecondsSinceEpochArg = args[2] as! Double - api.pigeonDelegate.removeDataOfTypes( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataTypes: dataTypesArg, - modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpochArg - ) { result in + api.pigeonDelegate.removeDataOfTypes(pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataTypes: dataTypesArg, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpochArg) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2809,26 +3415,21 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } ///Creates a Dart instance of WKWebsiteDataStore and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebsiteDataStore, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKWebsiteDataStore, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -2846,22 +3447,102 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKWebsiteDataStore`. +/// +/// 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 WebsiteDataStoreProxyAPIDelegate : PigeonApiDelegateWKWebsiteDataStore { + func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore): WKWebsiteDataStore { + return WKWebsiteDataStore.defaultDataStore + } + + func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore): WKHTTPCookieStore { + return pigeonInstance.httpCookieStore + } + + func removeDataOfTypes(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, completion: @escaping (Result) -> Void) { + return pigeonInstance.removeDataOfTypes(dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebsiteDataStoreProxyAPITests: XCTestCase { + func testHttpCookieStore() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebsiteDataStore(registrar) + + let instance = TestWebsiteDataStore() + let value = try? api.pigeonDelegate.httpCookieStore(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.httpCookieStore) + } + + func testRemoveDataOfTypes() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebsiteDataStore(registrar) + + let instance = TestWebsiteDataStore() + let dataTypes = [.cookies] + let modificationTimeInSecondsSinceEpoch = 1.0 + let value = api.pigeonDelegate.removeDataOfTypes(pigeonApi: api, pigeonInstance: instance, dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch) + + XCTAssertEqual(instance.removeDataOfTypesArgs, [dataTypes, modificationTimeInSecondsSinceEpoch]) + XCTAssertEqual(value, instance.removeDataOfTypes(dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch)) + } + +} +class TestWebsiteDataStore: WKWebsiteDataStore { + private var httpCookieStoreTestValue = TestHTTPCookieStore + var removeDataOfTypesArgs: [AnyHashable?]? = nil + + override var httpCookieStore: WKHTTPCookieStore { + return httpCookieStoreTestValue + } + + override func removeDataOfTypes() { + removeDataOfTypesArgs = [dataTypes, modificationTimeInSecondsSinceEpoch] + return true + } +} +*/ + protocol PigeonApiDelegateUIView { #if !os(macOS) - /// The view’s background color. - func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) - throws + /// The view’s background color. + func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) throws #endif #if !os(macOS) - /// A Boolean value that determines whether the view is opaque. - func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws + /// A Boolean value that determines whether the view is opaque. + func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws #endif } protocol PigeonApiProtocolUIView { } -final class PigeonApiUIView: PigeonApiProtocolUIView { +final class PigeonApiUIView: PigeonApiProtocolUIView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIView ///An implementation of [NSObject] used to access callback methods @@ -2877,162 +3558,215 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let setBackgroundColorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setBackgroundColor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBackgroundColorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIView - let valueArg: Int64? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setBackgroundColor( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setBackgroundColorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setBackgroundColor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBackgroundColorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIView + let valueArg: Int64? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setBackgroundColor(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setBackgroundColorChannel.setMessageHandler(nil) } + } else { + setBackgroundColorChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setOpaqueChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setOpaque", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setOpaqueChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIView - let opaqueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setOpaque( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, opaque: opaqueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - setOpaqueChannel.setMessageHandler(nil) + let setOpaqueChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setOpaque", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setOpaqueChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIView + let opaqueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setOpaque(pigeonApi: api, pigeonInstance: pigeonInstanceArg, opaque: opaqueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setOpaqueChannel.setMessageHandler(nil) + } #endif } #if !os(macOS) - ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: UIView, 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.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(())) - } + ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: UIView, 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.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(())) } } } + } #endif } + +/* +// 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 Foundation +import UIKit + + +/// ProxyApi implementation for `UIView`. +/// +/// 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 ViewProxyAPIDelegate : PigeonApiDelegateUIView { + func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) throws { + pigeonInstance.backgroundColor = value: value + } + + func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws { + pigeonInstance.opaque = opaque: opaque + } + +} +*/ + +/* +// 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 UIKit +import Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ViewProxyAPITests: XCTestCase { + func testSetBackgroundColor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIView(registrar) + + let instance = TestView() + let value = 0 + api.pigeonDelegate.setBackgroundColor(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setBackgroundColorArgs, [value]) + } + + func testSetOpaque() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIView(registrar) + + let instance = TestView() + let opaque = true + api.pigeonDelegate.setOpaque(pigeonApi: api, pigeonInstance: instance, opaque: opaque) + + XCTAssertEqual(instance.setOpaqueArgs, [opaque]) + } + +} +class TestView: UIView { + var setBackgroundColorArgs: [AnyHashable?]? = nil + var setOpaqueArgs: [AnyHashable?]? = nil + + + override func setBackgroundColor() { + setBackgroundColorArgs = [value] + } + override func setOpaque() { + setOpaqueArgs = [opaque] + } +} +*/ + protocol PigeonApiDelegateUIScrollView { #if !os(macOS) - /// The point at which the origin of the content view is offset from the - /// origin of the scroll view. - func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws - -> [Double] + /// The point at which the origin of the content view is offset from the + /// origin of the scroll view. + func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws -> [Double] #endif #if !os(macOS) - /// Move the scrolled position of your view. - /// - /// Convenience method to synchronize change to the x and y scroll position. - func scrollBy( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws + /// Move the scrolled position of your view. + /// + /// Convenience method to synchronize change to the x and y scroll position. + func scrollBy(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws #endif #if !os(macOS) - /// The point at which the origin of the content view is offset from the - /// origin of the scroll view. - func setContentOffset( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws + /// The point at which the origin of the content view is offset from the + /// origin of the scroll view. + func setContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws #endif #if !os(macOS) - /// The delegate of the scroll view. - func setDelegate( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, - delegate: UIScrollViewDelegate?) throws + /// The delegate of the scroll view. + func setDelegate(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, delegate: UIScrollViewDelegate?) throws #endif #if !os(macOS) - /// Whether the scroll view bounces past the edge of content and back again. - func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) - throws + /// Whether the scroll view bounces past the edge of content and back again. + func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether the scroll view bounces when it reaches the ends of its horizontal - /// axis. - func setBouncesHorizontally( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces when it reaches the ends of its horizontal + /// axis. + func setBouncesHorizontally(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether the scroll view bounces when it reaches the ends of its vertical - /// axis. - func setBouncesVertically( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces when it reaches the ends of its vertical + /// axis. + func setBouncesVertically(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether bouncing always occurs when vertical scrolling reaches the end of - /// the content. - /// - /// If the value of this property is true and `bouncesVertically` is true, the - /// scroll view allows vertical dragging even if the content is smaller than - /// the bounds of the scroll view. - func setAlwaysBounceVertical( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether bouncing always occurs when vertical scrolling reaches the end of + /// the content. + /// + /// If the value of this property is true and `bouncesVertically` is true, the + /// scroll view allows vertical dragging even if the content is smaller than + /// the bounds of the scroll view. + func setAlwaysBounceVertical(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether bouncing always occurs when horizontal scrolling reaches the end - /// of the content view. - /// - /// If the value of this property is true and `bouncesHorizontally` is true, - /// the scroll view allows horizontal dragging even if the content is smaller - /// than the bounds of the scroll view. - func setAlwaysBounceHorizontal( - pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether bouncing always occurs when horizontal scrolling reaches the end + /// of the content view. + /// + /// If the value of this property is true and `bouncesHorizontally` is true, + /// the scroll view allows horizontal dragging even if the content is smaller + /// than the bounds of the scroll view. + func setAlwaysBounceHorizontal(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif } protocol PigeonApiProtocolUIScrollView { } -final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { +final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIScrollView ///An implementation of [UIView] used to access callback methods @@ -3040,309 +3774,461 @@ final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { return pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollView - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollView? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollView?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let getContentOffsetChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.getContentOffset", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getContentOffsetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - do { - let result = try api.pigeonDelegate.getContentOffset( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getContentOffsetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.getContentOffset", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getContentOffsetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + do { + let result = try api.pigeonDelegate.getContentOffset(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getContentOffsetChannel.setMessageHandler(nil) } + } else { + getContentOffsetChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let scrollByChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.scrollBy", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - scrollByChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let xArg = args[1] as! Double - let yArg = args[2] as! Double - do { - try api.pigeonDelegate.scrollBy( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let scrollByChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.scrollBy", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + scrollByChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let xArg = args[1] as! Double + let yArg = args[2] as! Double + do { + try api.pigeonDelegate.scrollBy(pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - scrollByChannel.setMessageHandler(nil) } + } else { + scrollByChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setContentOffsetChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setContentOffset", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setContentOffsetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let xArg = args[1] as! Double - let yArg = args[2] as! Double - do { - try api.pigeonDelegate.setContentOffset( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setContentOffsetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setContentOffset", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setContentOffsetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let xArg = args[1] as! Double + let yArg = args[2] as! Double + do { + try api.pigeonDelegate.setContentOffset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setContentOffsetChannel.setMessageHandler(nil) } + } else { + setContentOffsetChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let delegateArg: UIScrollViewDelegate? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let delegateArg: UIScrollViewDelegate? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setDelegateChannel.setMessageHandler(nil) } + } else { + setDelegateChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setBouncesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBounces", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBounces( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setBouncesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBounces", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBounces(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setBouncesChannel.setMessageHandler(nil) } + } else { + setBouncesChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setBouncesHorizontallyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesHorizontally", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesHorizontallyChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBouncesHorizontally( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setBouncesHorizontallyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesHorizontally", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesHorizontallyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBouncesHorizontally(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setBouncesHorizontallyChannel.setMessageHandler(nil) } + } else { + setBouncesHorizontallyChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setBouncesVerticallyChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesVertically", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesVerticallyChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBouncesVertically( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setBouncesVerticallyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesVertically", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesVerticallyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBouncesVertically(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setBouncesVerticallyChannel.setMessageHandler(nil) } + } else { + setBouncesVerticallyChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setAlwaysBounceVerticalChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceVertical", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAlwaysBounceVerticalChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAlwaysBounceVertical( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAlwaysBounceVerticalChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceVertical", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAlwaysBounceVerticalChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAlwaysBounceVertical(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAlwaysBounceVerticalChannel.setMessageHandler(nil) } + } else { + setAlwaysBounceVerticalChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setAlwaysBounceHorizontalChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceHorizontal", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAlwaysBounceHorizontalChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAlwaysBounceHorizontal( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAlwaysBounceHorizontalChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceHorizontal", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAlwaysBounceHorizontalChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAlwaysBounceHorizontal(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAlwaysBounceHorizontalChannel.setMessageHandler(nil) } + } else { + setAlwaysBounceHorizontalChannel.setMessageHandler(nil) + } #endif } #if !os(macOS) - ///Creates a Dart instance of UIScrollView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: UIScrollView, 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.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(())) - } + ///Creates a Dart instance of UIScrollView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: UIScrollView, 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.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(())) } } } + } #endif } -protocol PigeonApiDelegateWKWebViewConfiguration { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws - -> WKWebViewConfiguration + +/* +// 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 Foundation +import UIKit + + +/// ProxyApi implementation for `UIScrollView`. +/// +/// 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 ScrollViewProxyAPIDelegate : PigeonApiDelegateUIScrollView { + func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws -> [Double] { + return pigeonInstance.contentOffset + } + + func scrollBy(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws { + pigeonInstance.scrollBy(x: x, y: y) + } + + func setContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws { + pigeonInstance.setContentOffset(x: x, y: y) + } + + func setDelegate(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, delegate: UIScrollViewDelegate?) throws { + pigeonInstance.delegate = delegate: delegate + } + + func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.bounces = value: value + } + + func setBouncesHorizontally(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.bouncesHorizontally = value: value + } + + func setBouncesVertically(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.bouncesVertically = value: value + } + + func setAlwaysBounceVertical(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.alwaysBounceVertical = value: value + } + + func setAlwaysBounceHorizontal(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { + pigeonInstance.alwaysBounceHorizontal = value: value + } + +} +*/ + +/* +// 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 UIKit +import Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ScrollViewProxyAPITests: XCTestCase { + func testGetContentOffset() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = api.pigeonDelegate.getContentOffset(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getContentOffsetCalled) + XCTAssertEqual(value, instance.getContentOffset()) + } + + func testScrollBy() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let x = 1.0 + let y = 1.0 + api.pigeonDelegate.scrollBy(pigeonApi: api, pigeonInstance: instance, x: x, y: y) + + XCTAssertEqual(instance.scrollByArgs, [x, y]) + } + + func testSetContentOffset() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let x = 1.0 + let y = 1.0 + api.pigeonDelegate.setContentOffset(pigeonApi: api, pigeonInstance: instance, x: x, y: y) + + XCTAssertEqual(instance.setContentOffsetArgs, [x, y]) + } + + func testSetDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let delegate = TestScrollViewDelegate + api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setDelegateArgs, [delegate]) + } + + func testSetBounces() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setBounces(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setBouncesArgs, [value]) + } + + func testSetBouncesHorizontally() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setBouncesHorizontally(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setBouncesHorizontallyArgs, [value]) + } + + func testSetBouncesVertically() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setBouncesVertically(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setBouncesVerticallyArgs, [value]) + } + + func testSetAlwaysBounceVertical() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setAlwaysBounceVertical(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setAlwaysBounceVerticalArgs, [value]) + } + + func testSetAlwaysBounceHorizontal() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) + + let instance = TestScrollView() + let value = true + api.pigeonDelegate.setAlwaysBounceHorizontal(pigeonApi: api, pigeonInstance: instance, value: value) + + XCTAssertEqual(instance.setAlwaysBounceHorizontalArgs, [value]) + } + +} +class TestScrollView: UIScrollView { + var getContentOffsetCalled = false + var scrollByArgs: [AnyHashable?]? = nil + var setContentOffsetArgs: [AnyHashable?]? = nil + var setDelegateArgs: [AnyHashable?]? = nil + var setBouncesArgs: [AnyHashable?]? = nil + var setBouncesHorizontallyArgs: [AnyHashable?]? = nil + var setBouncesVerticallyArgs: [AnyHashable?]? = nil + var setAlwaysBounceVerticalArgs: [AnyHashable?]? = nil + var setAlwaysBounceHorizontalArgs: [AnyHashable?]? = nil + + + override func getContentOffset() { + getContentOffsetCalled = true + } + override func scrollBy() { + scrollByArgs = [x, y] + } + override func setContentOffset() { + setContentOffsetArgs = [x, y] + } + override func setDelegate() { + setDelegateArgs = [delegate] + } + override func setBounces() { + setBouncesArgs = [value] + } + override func setBouncesHorizontally() { + setBouncesHorizontallyArgs = [value] + } + override func setBouncesVertically() { + setBouncesVerticallyArgs = [value] + } + override func setAlwaysBounceVertical() { + setAlwaysBounceVerticalArgs = [value] + } + override func setAlwaysBounceHorizontal() { + setAlwaysBounceHorizontalArgs = [value] + } +} +*/ + +protocol PigeonApiDelegateWKWebViewConfiguration { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration /// The object that coordinates interactions between your app’s native code /// and the webpage’s scripts and other content. - func setUserContentController( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, - controller: WKUserContentController) throws + func setUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, controller: WKUserContentController) throws /// The object that coordinates interactions between your app’s native code /// and the webpage’s scripts and other content. - func getUserContentController( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration - ) throws -> WKUserContentController + func getUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKUserContentController /// The object you use to get and set the site’s cookies and to track the /// cached data objects. - func setWebsiteDataStore( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, - dataStore: WKWebsiteDataStore) throws + func setWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, dataStore: WKWebsiteDataStore) throws /// The object you use to get and set the site’s cookies and to track the /// cached data objects. - func getWebsiteDataStore( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration - ) throws -> WKWebsiteDataStore + func getWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebsiteDataStore /// The object that manages the preference-related settings for the web view. - func setPreferences( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, - preferences: WKPreferences) throws + func setPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, preferences: WKPreferences) throws /// The object that manages the preference-related settings for the web view. - func getPreferences( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration - ) throws -> WKPreferences + func getPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKPreferences /// A Boolean value that indicates whether HTML5 videos play inline or use the /// native full-screen controller. - func setAllowsInlineMediaPlayback( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) - throws + func setAllowsInlineMediaPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) throws /// A Boolean value that indicates whether the web view limits navigation to /// pages within the app’s domain. - func setLimitsNavigationsToAppBoundDomains( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) - throws + func setLimitsNavigationsToAppBoundDomains(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) throws /// The media types that require a user gesture to begin playing. - func setMediaTypesRequiringUserActionForPlayback( - pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, - type: AudiovisualMediaType) throws + 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 + func getDefaultWebpagePreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebpagePreferences } protocol PigeonApiProtocolWKWebViewConfiguration { } -final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfiguration { +final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfiguration { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebViewConfiguration ///An implementation of [NSObject] used to access callback methods @@ -3350,34 +4236,25 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKWebViewConfiguration - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebViewConfiguration) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebViewConfiguration? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebViewConfiguration?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3386,18 +4263,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setUserContentControllerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setUserContentController", - binaryMessenger: binaryMessenger, codec: codec) + let setUserContentControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setUserContentController", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setUserContentControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let controllerArg = args[1] as! WKUserContentController do { - try api.pigeonDelegate.setUserContentController( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) + try api.pigeonDelegate.setUserContentController(pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3406,17 +4279,13 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setUserContentControllerChannel.setMessageHandler(nil) } - let getUserContentControllerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getUserContentController", - binaryMessenger: binaryMessenger, codec: codec) + let getUserContentControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getUserContentController", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getUserContentControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getUserContentController( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getUserContentController(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3425,18 +4294,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { getUserContentControllerChannel.setMessageHandler(nil) } - let setWebsiteDataStoreChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setWebsiteDataStore", - binaryMessenger: binaryMessenger, codec: codec) + let setWebsiteDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setWebsiteDataStore", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setWebsiteDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let dataStoreArg = args[1] as! WKWebsiteDataStore do { - try api.pigeonDelegate.setWebsiteDataStore( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataStore: dataStoreArg) + try api.pigeonDelegate.setWebsiteDataStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataStore: dataStoreArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3445,17 +4310,13 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setWebsiteDataStoreChannel.setMessageHandler(nil) } - let getWebsiteDataStoreChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getWebsiteDataStore", - binaryMessenger: binaryMessenger, codec: codec) + let getWebsiteDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getWebsiteDataStore", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getWebsiteDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getWebsiteDataStore( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getWebsiteDataStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3464,17 +4325,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { getWebsiteDataStoreChannel.setMessageHandler(nil) } - let setPreferencesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setPreferences", - binaryMessenger: binaryMessenger, codec: codec) + let setPreferencesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setPreferences", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setPreferencesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let preferencesArg = args[1] as! WKPreferences do { - try api.pigeonDelegate.setPreferences( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, preferences: preferencesArg) + try api.pigeonDelegate.setPreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg, preferences: preferencesArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3483,16 +4341,13 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setPreferencesChannel.setMessageHandler(nil) } - let getPreferencesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getPreferences", - binaryMessenger: binaryMessenger, codec: codec) + let getPreferencesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getPreferences", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getPreferencesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getPreferences( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getPreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3501,18 +4356,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { getPreferencesChannel.setMessageHandler(nil) } - let setAllowsInlineMediaPlaybackChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setAllowsInlineMediaPlayback", - binaryMessenger: binaryMessenger, codec: codec) + let setAllowsInlineMediaPlaybackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setAllowsInlineMediaPlayback", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAllowsInlineMediaPlaybackChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let allowArg = args[1] as! Bool do { - try api.pigeonDelegate.setAllowsInlineMediaPlayback( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + try api.pigeonDelegate.setAllowsInlineMediaPlayback(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3521,18 +4372,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setAllowsInlineMediaPlaybackChannel.setMessageHandler(nil) } - let setLimitsNavigationsToAppBoundDomainsChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains", - binaryMessenger: binaryMessenger, codec: codec) + let setLimitsNavigationsToAppBoundDomainsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLimitsNavigationsToAppBoundDomainsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let limitArg = args[1] as! Bool do { - try api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, limit: limitArg) + try api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains(pigeonApi: api, pigeonInstance: pigeonInstanceArg, limit: limitArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3541,18 +4388,14 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { setLimitsNavigationsToAppBoundDomainsChannel.setMessageHandler(nil) } - let setMediaTypesRequiringUserActionForPlaybackChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback", - binaryMessenger: binaryMessenger, codec: codec) + let setMediaTypesRequiringUserActionForPlaybackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setMediaTypesRequiringUserActionForPlaybackChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let typeArg = args[1] as! AudiovisualMediaType do { - try api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, type: typeArg) + try api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback(pigeonApi: api, pigeonInstance: pigeonInstanceArg, type: typeArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3562,17 +4405,13 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura 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) + 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) + let result = try api.pigeonDelegate.getDefaultWebpagePreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3581,21 +4420,16 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } else { getDefaultWebpagePreferencesChannel.setMessageHandler(nil) } - } else { + } else { let getDefaultWebpagePreferencesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getDefaultWebpagePreferences", + 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 - ))) + 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) @@ -3604,27 +4438,21 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } ///Creates a Dart instance of WKWebViewConfiguration and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebViewConfiguration, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKWebViewConfiguration, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -3642,33 +4470,264 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKWebViewConfiguration`. +/// +/// 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 WebViewConfigurationProxyAPIDelegate : PigeonApiDelegateWKWebViewConfiguration { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration { + return WKWebViewConfiguration() + } + + func setUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, controller: WKUserContentController) throws { + pigeonInstance.userContentController = controller: controller + } + + func getUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKUserContentController { + return pigeonInstance.userContentController + } + + func setWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, dataStore: WKWebsiteDataStore) throws { + pigeonInstance.websiteDataStore = dataStore: dataStore + } + + func getWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebsiteDataStore { + return pigeonInstance.websiteDataStore + } + + func setPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, preferences: WKPreferences) throws { + pigeonInstance.preferences = preferences: preferences + } + + func getPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKPreferences { + return pigeonInstance.preferences + } + + func setAllowsInlineMediaPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) throws { + pigeonInstance.allowsInlineMediaPlayback = allow: allow + } + + func setLimitsNavigationsToAppBoundDomains(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) throws { + pigeonInstance.limitsNavigationsToAppBoundDomains = limit: limit + } + + func setMediaTypesRequiringUserActionForPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, type: AudiovisualMediaType) throws { + pigeonInstance.mediaTypesRequiringUserActionForPlayback = type: type + } + + func getDefaultWebpagePreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebpagePreferences { + return pigeonInstance.defaultWebpagePreferences + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebViewConfigurationProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testSetUserContentController() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let controller = TestUserContentController + api.pigeonDelegate.setUserContentController(pigeonApi: api, pigeonInstance: instance, controller: controller) + + XCTAssertEqual(instance.setUserContentControllerArgs, [controller]) + } + + func testGetUserContentController() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let value = api.pigeonDelegate.getUserContentController(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getUserContentControllerCalled) + XCTAssertEqual(value, instance.getUserContentController()) + } + + func testSetWebsiteDataStore() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let dataStore = TestWebsiteDataStore + api.pigeonDelegate.setWebsiteDataStore(pigeonApi: api, pigeonInstance: instance, dataStore: dataStore) + + XCTAssertEqual(instance.setWebsiteDataStoreArgs, [dataStore]) + } + + func testGetWebsiteDataStore() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let value = api.pigeonDelegate.getWebsiteDataStore(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getWebsiteDataStoreCalled) + XCTAssertEqual(value, instance.getWebsiteDataStore()) + } + + func testSetPreferences() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let preferences = TestPreferences + api.pigeonDelegate.setPreferences(pigeonApi: api, pigeonInstance: instance, preferences: preferences) + + XCTAssertEqual(instance.setPreferencesArgs, [preferences]) + } + + func testGetPreferences() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let value = api.pigeonDelegate.getPreferences(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getPreferencesCalled) + XCTAssertEqual(value, instance.getPreferences()) + } + + func testSetAllowsInlineMediaPlayback() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let allow = true + api.pigeonDelegate.setAllowsInlineMediaPlayback(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsInlineMediaPlaybackArgs, [allow]) + } + + func testSetLimitsNavigationsToAppBoundDomains() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let limit = true + api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains(pigeonApi: api, pigeonInstance: instance, limit: limit) + + XCTAssertEqual(instance.setLimitsNavigationsToAppBoundDomainsArgs, [limit]) + } + + func testSetMediaTypesRequiringUserActionForPlayback() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let type = .none + api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback(pigeonApi: api, pigeonInstance: instance, type: type) + + XCTAssertEqual(instance.setMediaTypesRequiringUserActionForPlaybackArgs, [type]) + } + + func testGetDefaultWebpagePreferences() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) + + let instance = TestWebViewConfiguration() + let value = api.pigeonDelegate.getDefaultWebpagePreferences(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getDefaultWebpagePreferencesCalled) + XCTAssertEqual(value, instance.getDefaultWebpagePreferences()) + } + +} +class TestWebViewConfiguration: WKWebViewConfiguration { + var setUserContentControllerArgs: [AnyHashable?]? = nil + var getUserContentControllerCalled = false + var setWebsiteDataStoreArgs: [AnyHashable?]? = nil + var getWebsiteDataStoreCalled = false + var setPreferencesArgs: [AnyHashable?]? = nil + var getPreferencesCalled = false + var setAllowsInlineMediaPlaybackArgs: [AnyHashable?]? = nil + var setLimitsNavigationsToAppBoundDomainsArgs: [AnyHashable?]? = nil + var setMediaTypesRequiringUserActionForPlaybackArgs: [AnyHashable?]? = nil + var getDefaultWebpagePreferencesCalled = false + + + override func setUserContentController() { + setUserContentControllerArgs = [controller] + } + override func getUserContentController() { + getUserContentControllerCalled = true + } + override func setWebsiteDataStore() { + setWebsiteDataStoreArgs = [dataStore] + } + override func getWebsiteDataStore() { + getWebsiteDataStoreCalled = true + } + override func setPreferences() { + setPreferencesArgs = [preferences] + } + override func getPreferences() { + getPreferencesCalled = true + } + override func setAllowsInlineMediaPlayback() { + setAllowsInlineMediaPlaybackArgs = [allow] + } + override func setLimitsNavigationsToAppBoundDomains() { + setLimitsNavigationsToAppBoundDomainsArgs = [limit] + } + override func setMediaTypesRequiringUserActionForPlayback() { + setMediaTypesRequiringUserActionForPlaybackArgs = [type] + } + override func getDefaultWebpagePreferences() { + getDefaultWebpagePreferencesCalled = true + } +} +*/ + protocol PigeonApiDelegateWKUserContentController { /// Installs a message handler that you can call from your JavaScript code. - func addScriptMessageHandler( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, - handler: WKScriptMessageHandler, name: String) throws + func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws /// Uninstalls the custom message handler with the specified name from your /// JavaScript code. - func removeScriptMessageHandler( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, - name: String) throws + func removeScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, name: String) throws /// Uninstalls all custom message handlers associated with the user content /// controller. - func removeAllScriptMessageHandlers( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws + func removeAllScriptMessageHandlers(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws /// Injects the specified script into the webpage’s content. - func addUserScript( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, - userScript: WKUserScript) throws + func addUserScript(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, userScript: WKUserScript) throws /// Removes all user scripts from the web view. - func removeAllUserScripts( - pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws + func removeAllUserScripts(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws } protocol PigeonApiProtocolWKUserContentController { } -final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentController { +final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentController { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUserContentController ///An implementation of [NSObject] used to access callback methods @@ -3676,26 +4735,17 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKUserContentController - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserContentController) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserContentController? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserContentController?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let addScriptMessageHandlerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addScriptMessageHandler", - binaryMessenger: binaryMessenger, codec: codec) + let addScriptMessageHandlerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addScriptMessageHandler", binaryMessenger: binaryMessenger, codec: codec) if let api = api { addScriptMessageHandlerChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3703,8 +4753,7 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont let handlerArg = args[1] as! WKScriptMessageHandler let nameArg = args[2] as! String do { - try api.pigeonDelegate.addScriptMessageHandler( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, handler: handlerArg, name: nameArg) + try api.pigeonDelegate.addScriptMessageHandler(pigeonApi: api, pigeonInstance: pigeonInstanceArg, handler: handlerArg, name: nameArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3713,18 +4762,14 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { addScriptMessageHandlerChannel.setMessageHandler(nil) } - let removeScriptMessageHandlerChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeScriptMessageHandler", - binaryMessenger: binaryMessenger, codec: codec) + let removeScriptMessageHandlerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeScriptMessageHandler", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeScriptMessageHandlerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController let nameArg = args[1] as! String do { - try api.pigeonDelegate.removeScriptMessageHandler( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, name: nameArg) + try api.pigeonDelegate.removeScriptMessageHandler(pigeonApi: api, pigeonInstance: pigeonInstanceArg, name: nameArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3733,17 +4778,13 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { removeScriptMessageHandlerChannel.setMessageHandler(nil) } - let removeAllScriptMessageHandlersChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllScriptMessageHandlers", - binaryMessenger: binaryMessenger, codec: codec) + let removeAllScriptMessageHandlersChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllScriptMessageHandlers", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeAllScriptMessageHandlersChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController do { - try api.pigeonDelegate.removeAllScriptMessageHandlers( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.removeAllScriptMessageHandlers(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3752,17 +4793,14 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { removeAllScriptMessageHandlersChannel.setMessageHandler(nil) } - let addUserScriptChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addUserScript", - binaryMessenger: binaryMessenger, codec: codec) + let addUserScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addUserScript", binaryMessenger: binaryMessenger, codec: codec) if let api = api { addUserScriptChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController let userScriptArg = args[1] as! WKUserScript do { - try api.pigeonDelegate.addUserScript( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, userScript: userScriptArg) + try api.pigeonDelegate.addUserScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userScript: userScriptArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3771,17 +4809,13 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { addUserScriptChannel.setMessageHandler(nil) } - let removeAllUserScriptsChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllUserScripts", - binaryMessenger: binaryMessenger, codec: codec) + let removeAllUserScriptsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllUserScripts", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeAllUserScriptsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController do { - try api.pigeonDelegate.removeAllUserScripts( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.removeAllUserScripts(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3793,27 +4827,21 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } ///Creates a Dart instance of WKUserContentController and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKUserContentController, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKUserContentController, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -3831,16 +4859,146 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKUserContentController`. +/// +/// 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 UserContentControllerProxyAPIDelegate : PigeonApiDelegateWKUserContentController { + func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws { + pigeonInstance.addScriptMessageHandler(handler: handler, name: name) + } + + func removeScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, name: String) throws { + pigeonInstance.removeScriptMessageHandler(name: name) + } + + func removeAllScriptMessageHandlers(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws { + pigeonInstance.removeAllScriptMessageHandlers() + } + + func addUserScript(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, userScript: WKUserScript) throws { + pigeonInstance.addUserScript(userScript: userScript) + } + + func removeAllUserScripts(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws { + pigeonInstance.removeAllUserScripts() + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class UserContentControllerProxyAPITests: XCTestCase { + func testAddScriptMessageHandler() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + let handler = TestScriptMessageHandler + let name = "myString" + api.pigeonDelegate.addScriptMessageHandler(pigeonApi: api, pigeonInstance: instance, handler: handler, name: name) + + XCTAssertEqual(instance.addScriptMessageHandlerArgs, [handler, name]) + } + + func testRemoveScriptMessageHandler() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + let name = "myString" + api.pigeonDelegate.removeScriptMessageHandler(pigeonApi: api, pigeonInstance: instance, name: name) + + XCTAssertEqual(instance.removeScriptMessageHandlerArgs, [name]) + } + + func testRemoveAllScriptMessageHandlers() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + api.pigeonDelegate.removeAllScriptMessageHandlers(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.removeAllScriptMessageHandlersCalled) + } + + func testAddUserScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + let userScript = TestUserScript + api.pigeonDelegate.addUserScript(pigeonApi: api, pigeonInstance: instance, userScript: userScript) + + XCTAssertEqual(instance.addUserScriptArgs, [userScript]) + } + + func testRemoveAllUserScripts() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) + + let instance = TestUserContentController() + api.pigeonDelegate.removeAllUserScripts(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.removeAllUserScriptsCalled) + } + +} +class TestUserContentController: WKUserContentController { + var addScriptMessageHandlerArgs: [AnyHashable?]? = nil + var removeScriptMessageHandlerArgs: [AnyHashable?]? = nil + var removeAllScriptMessageHandlersCalled = false + var addUserScriptArgs: [AnyHashable?]? = nil + var removeAllUserScriptsCalled = false + + + override func addScriptMessageHandler() { + addScriptMessageHandlerArgs = [handler, name] + } + override func removeScriptMessageHandler() { + removeScriptMessageHandlerArgs = [name] + } + override func removeAllScriptMessageHandlers() { + removeAllScriptMessageHandlersCalled = true + } + override func addUserScript() { + addUserScriptArgs = [userScript] + } + override func removeAllUserScripts() { + removeAllUserScriptsCalled = true + } +} +*/ + protocol PigeonApiDelegateWKPreferences { /// A Boolean value that indicates whether JavaScript is enabled. - func setJavaScriptEnabled( - pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws + func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws } protocol PigeonApiProtocolWKPreferences { } -final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { +final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKPreferences ///An implementation of [NSObject] used to access callback methods @@ -3848,32 +5006,24 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKPreferences - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKPreferences) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKPreferences? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKPreferences?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setJavaScriptEnabledChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.setJavaScriptEnabled", - binaryMessenger: binaryMessenger, codec: codec) + let setJavaScriptEnabledChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.setJavaScriptEnabled", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setJavaScriptEnabledChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKPreferences let enabledArg = args[1] as! Bool do { - try api.pigeonDelegate.setJavaScriptEnabled( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, enabled: enabledArg) + try api.pigeonDelegate.setJavaScriptEnabled(pigeonApi: api, pigeonInstance: pigeonInstanceArg, enabled: enabledArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3885,26 +5035,21 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } ///Creates a Dart instance of WKPreferences and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKPreferences, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKPreferences, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -3922,20 +5067,72 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKPreferences`. +/// +/// 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 PreferencesProxyAPIDelegate : PigeonApiDelegateWKPreferences { + func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws { + pigeonInstance.javaScriptEnabled = enabled: enabled + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class PreferencesProxyAPITests: XCTestCase { + func testSetJavaScriptEnabled() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKPreferences(registrar) + + let instance = TestPreferences() + let enabled = true + api.pigeonDelegate.setJavaScriptEnabled(pigeonApi: api, pigeonInstance: instance, enabled: enabled) + + XCTAssertEqual(instance.setJavaScriptEnabledArgs, [enabled]) + } + +} +class TestPreferences: WKPreferences { + var setJavaScriptEnabledArgs: [AnyHashable?]? = nil + + + override func setJavaScriptEnabled() { + setJavaScriptEnabledArgs = [enabled] + } +} +*/ + protocol PigeonApiDelegateWKScriptMessageHandler { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws - -> WKScriptMessageHandler + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler } protocol PigeonApiProtocolWKScriptMessageHandler { /// Tells the handler that a webpage sent a script message. - func didReceiveScriptMessage( - pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, - controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, - completion: @escaping (Result) -> Void) + func didReceiveScriptMessage(pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, completion: @escaping (Result) -> Void) } -final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHandler { +final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHandler { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKScriptMessageHandler ///An implementation of [NSObject] used to access callback methods @@ -3943,34 +5140,25 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKScriptMessageHandler - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKScriptMessageHandler) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKScriptMessageHandler? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKScriptMessageHandler?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3982,34 +5170,25 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan } ///Creates a Dart instance of WKScriptMessageHandler and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKScriptMessageHandler, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKScriptMessageHandler, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + message: "Error: Attempting to create a new Dart instance of WKScriptMessageHandler, but the class has a nonnull callback method.", details: ""))) } } /// Tells the handler that a webpage sent a script message. - func didReceiveScriptMessage( - pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, - controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, - completion: @escaping (Result) -> Void - ) { + func didReceiveScriptMessage(pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4020,10 +5199,8 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.didReceiveScriptMessage" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.didReceiveScriptMessage" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, controllerArg, messageArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4041,63 +5218,107 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan } } + +/* +// 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 Foundation +import WebKit + +/// Implementation of `WKScriptMessageHandler` that calls to Dart in callback methods. +class ScriptMessageHandlerImpl: WKScriptMessageHandler { + let api: PigeonApiProtocolWKScriptMessageHandler + + init(api: PigeonApiProtocolWKScriptMessageHandler) { + self.api = api + } + + func fixMe() { + api.didReceiveScriptMessage(pigeonInstance: self, controller: controller, message: message) { _ in } + } +} + +/// ProxyApi implementation for `WKScriptMessageHandler`. +/// +/// 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 ScriptMessageHandlerProxyAPIDelegate : PigeonApiDelegateWKScriptMessageHandler { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler { + return WKScriptMessageHandlerImpl(api: pigeonApi) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ScriptMessageHandlerProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKScriptMessageHandler(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testDidReceiveScriptMessage() { + let api = TestScriptMessageHandlerApi() + let instance = ScriptMessageHandlerImpl(api: api) + let controller = TestUserContentController + let message = TestScriptMessage + instance.didReceiveScriptMessage(controller: controller, message: message) + + XCTAssertEqual(api.didReceiveScriptMessageArgs, [controller, message]) + } + +} +class TestScriptMessageHandlerApi: PigeonApiProtocolWKScriptMessageHandler { + var didReceiveScriptMessageArgs: [AnyHashable?]? = nil + + func didReceiveScriptMessage(controller: WKUserContentController, message: WKScriptMessage) throws { + didReceiveScriptMessageArgs = [controllerArg, messageArg] + } +} +*/ + protocol PigeonApiDelegateWKNavigationDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws - -> WKNavigationDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate } protocol PigeonApiProtocolWKNavigationDelegate { /// Tells the delegate that navigation is complete. - func didFinishNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - url urlArg: String?, completion: @escaping (Result) -> Void) + func didFinishNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) /// Tells the delegate that navigation from the main frame has started. - func didStartProvisionalNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - url urlArg: String?, completion: @escaping (Result) -> Void) + func didStartProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) /// Asks the delegate for permission to navigate to new content based on the /// specified action information. - func decidePolicyForNavigationAction( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - navigationAction navigationActionArg: WKNavigationAction, - completion: @escaping (Result) -> Void) + func decidePolicyForNavigationAction(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. - func decidePolicyForNavigationResponse( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - navigationResponse navigationResponseArg: WKNavigationResponse, - completion: @escaping (Result) -> Void) + func decidePolicyForNavigationResponse(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationResponse navigationResponseArg: WKNavigationResponse, completion: @escaping (Result) -> Void) /// Tells the delegate that an error occurred during navigation. - func didFailNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - error errorArg: NSError, completion: @escaping (Result) -> Void) + func didFailNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) /// Tells the delegate that an error occurred during the early navigation /// process. - func didFailProvisionalNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - error errorArg: NSError, completion: @escaping (Result) -> Void) + func didFailProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) /// Tells the delegate that the web view’s content process was terminated. - func webViewWebContentProcessDidTerminate( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - completion: @escaping (Result) -> Void) + func webViewWebContentProcessDidTerminate(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, completion: @escaping (Result) -> Void) /// Asks the delegate to respond to an authentication challenge. - /// - /// This return value expects a List with: - /// - /// 1. `UrlSessionAuthChallengeDisposition` - /// 2. A nullable map to instantiate a `URLCredential`. The map structure is - /// [ - /// "user": "", - /// "password": "", - /// "persistence": , - /// ] - func didReceiveAuthenticationChallenge( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - challenge challengeArg: URLAuthenticationChallenge, - completion: @escaping (Result<[Any?], PigeonError>) -> Void) -} - -final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate { + func didReceiveAuthenticationChallenge(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping (Result) -> Void) +} + +final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationDelegate ///An implementation of [NSObject] used to access callback methods @@ -4105,34 +5326,25 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKNavigationDelegate - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKNavigationDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKNavigationDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -4144,32 +5356,25 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } ///Creates a Dart instance of WKNavigationDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKNavigationDelegate, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKNavigationDelegate, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + 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. - func didFinishNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - url urlArg: String?, completion: @escaping (Result) -> Void - ) { + func didFinishNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4180,10 +5385,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFinishNavigation" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFinishNavigation" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, urlArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4201,10 +5404,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } /// Tells the delegate that navigation from the main frame has started. - func didStartProvisionalNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - url urlArg: String?, completion: @escaping (Result) -> Void - ) { + func didStartProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4215,10 +5415,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didStartProvisionalNavigation" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didStartProvisionalNavigation" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, urlArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4237,11 +5435,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate /// Asks the delegate for permission to navigate to new content based on the /// specified action information. - func decidePolicyForNavigationAction( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - navigationAction navigationActionArg: WKNavigationAction, - completion: @escaping (Result) -> Void - ) { + func decidePolicyForNavigationAction(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4252,12 +5446,9 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, navigationActionArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, navigationActionArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -4268,11 +5459,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! NavigationActionPolicy completion(.success(result)) @@ -4282,11 +5469,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. - func decidePolicyForNavigationResponse( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - navigationResponse navigationResponseArg: WKNavigationResponse, - completion: @escaping (Result) -> Void - ) { + func decidePolicyForNavigationResponse(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationResponse navigationResponseArg: WKNavigationResponse, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4297,12 +5480,9 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, navigationResponseArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, navigationResponseArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -4313,11 +5493,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! NavigationResponsePolicy completion(.success(result)) @@ -4326,10 +5502,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } /// Tells the delegate that an error occurred during navigation. - func didFailNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - error errorArg: NSError, completion: @escaping (Result) -> Void - ) { + func didFailNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4340,10 +5513,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailNavigation" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailNavigation" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4362,10 +5533,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate /// Tells the delegate that an error occurred during the early navigation /// process. - func didFailProvisionalNavigation( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - error errorArg: NSError, completion: @escaping (Result) -> Void - ) { + func didFailProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4376,10 +5544,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailProvisionalNavigation" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailProvisionalNavigation" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4397,10 +5563,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } /// Tells the delegate that the web view’s content process was terminated. - func webViewWebContentProcessDidTerminate( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - completion: @escaping (Result) -> Void - ) { + func webViewWebContentProcessDidTerminate(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4411,10 +5574,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.webViewWebContentProcessDidTerminate" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.webViewWebContentProcessDidTerminate" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4432,21 +5593,7 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } /// Asks the delegate to respond to an authentication challenge. - /// - /// This return value expects a List with: - /// - /// 1. `UrlSessionAuthChallengeDisposition` - /// 2. A nullable map to instantiate a `URLCredential`. The map structure is - /// [ - /// "user": "", - /// "password": "", - /// "persistence": , - /// ] - func didReceiveAuthenticationChallenge( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, - challenge challengeArg: URLAuthenticationChallenge, - completion: @escaping (Result<[Any?], PigeonError>) -> Void - ) { + func didReceiveAuthenticationChallenge(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4457,10 +5604,8 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, challengeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -4472,69 +5617,253 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { - let result = listResponse[0] as! [Any?] + let result = listResponse[0] as! AuthenticationChallengeResponse completion(.success(result)) } } } } + +/* +// 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 Foundation +import WebKit + +/// Implementation of `WKNavigationDelegate` that calls to Dart in callback methods. +class NavigationDelegateImpl: WKNavigationDelegate { + let api: PigeonApiProtocolWKNavigationDelegate + + init(api: PigeonApiProtocolWKNavigationDelegate) { + self.api = api + } + + func fixMe() { + api.didFinishNavigation(pigeonInstance: self, webView: webView, url: url) { _ in } + } + + func fixMe() { + api.didStartProvisionalNavigation(pigeonInstance: self, webView: webView, url: url) { _ in } + } + + func fixMe() { + api.decidePolicyForNavigationAction(pigeonInstance: self, webView: webView, navigationAction: navigationAction) { _ in } + } + + func fixMe() { + api.decidePolicyForNavigationResponse(pigeonInstance: self, webView: webView, navigationResponse: navigationResponse) { _ in } + } + + func fixMe() { + api.didFailNavigation(pigeonInstance: self, webView: webView, error: error) { _ in } + } + + func fixMe() { + api.didFailProvisionalNavigation(pigeonInstance: self, webView: webView, error: error) { _ in } + } + + func fixMe() { + api.webViewWebContentProcessDidTerminate(pigeonInstance: self, webView: webView) { _ in } + } + + func fixMe() { + api.didReceiveAuthenticationChallenge(pigeonInstance: self, webView: webView, challenge: challenge) { _ in } + } +} + +/// ProxyApi implementation for `WKNavigationDelegate`. +/// +/// 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 NavigationDelegateProxyAPIDelegate : PigeonApiDelegateWKNavigationDelegate { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate { + return WKNavigationDelegateImpl(api: pigeonApi) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class NavigationDelegateProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKNavigationDelegate(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testDidFinishNavigation() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let url = "myString" + instance.didFinishNavigation(webView: webView, url: url) + + XCTAssertEqual(api.didFinishNavigationArgs, [webView, url]) + } + + func testDidStartProvisionalNavigation() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let url = "myString" + instance.didStartProvisionalNavigation(webView: webView, url: url) + + XCTAssertEqual(api.didStartProvisionalNavigationArgs, [webView, url]) + } + + func testDecidePolicyForNavigationAction() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let navigationAction = TestNavigationAction + instance.decidePolicyForNavigationAction(webView: webView, navigationAction: navigationAction) + + XCTAssertEqual(api.decidePolicyForNavigationActionArgs, [webView, navigationAction]) + } + + func testDecidePolicyForNavigationResponse() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let navigationResponse = TestNavigationResponse + instance.decidePolicyForNavigationResponse(webView: webView, navigationResponse: navigationResponse) + + XCTAssertEqual(api.decidePolicyForNavigationResponseArgs, [webView, navigationResponse]) + } + + func testDidFailNavigation() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let error = TestError + instance.didFailNavigation(webView: webView, error: error) + + XCTAssertEqual(api.didFailNavigationArgs, [webView, error]) + } + + func testDidFailProvisionalNavigation() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let error = TestError + instance.didFailProvisionalNavigation(webView: webView, error: error) + + XCTAssertEqual(api.didFailProvisionalNavigationArgs, [webView, error]) + } + + func testWebViewWebContentProcessDidTerminate() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + instance.webViewWebContentProcessDidTerminate(webView: webView) + + XCTAssertEqual(api.webViewWebContentProcessDidTerminateArgs, [webView]) + } + + func testDidReceiveAuthenticationChallenge() { + let api = TestNavigationDelegateApi() + let instance = NavigationDelegateImpl(api: api) + let webView = TestWebView + let challenge = TestURLAuthenticationChallenge + instance.didReceiveAuthenticationChallenge(webView: webView, challenge: challenge) + + XCTAssertEqual(api.didReceiveAuthenticationChallengeArgs, [webView, challenge]) + } + +} +class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate { + var didFinishNavigationArgs: [AnyHashable?]? = nil + var didStartProvisionalNavigationArgs: [AnyHashable?]? = nil + var decidePolicyForNavigationActionArgs: [AnyHashable?]? = nil + var decidePolicyForNavigationResponseArgs: [AnyHashable?]? = nil + var didFailNavigationArgs: [AnyHashable?]? = nil + var didFailProvisionalNavigationArgs: [AnyHashable?]? = nil + var webViewWebContentProcessDidTerminateArgs: [AnyHashable?]? = nil + var didReceiveAuthenticationChallengeArgs: [AnyHashable?]? = nil + + func didFinishNavigation(webView: WKWebView, url: String?) throws { + didFinishNavigationArgs = [webViewArg, urlArg] + } + func didStartProvisionalNavigation(webView: WKWebView, url: String?) throws { + didStartProvisionalNavigationArgs = [webViewArg, urlArg] + } + func decidePolicyForNavigationAction(webView: WKWebView, navigationAction: WKNavigationAction) throws -> NavigationActionPolicy { + decidePolicyForNavigationActionArgs = [webViewArg, navigationActionArg] + } + func decidePolicyForNavigationResponse(webView: WKWebView, navigationResponse: WKNavigationResponse) throws -> NavigationResponsePolicy { + decidePolicyForNavigationResponseArgs = [webViewArg, navigationResponseArg] + } + func didFailNavigation(webView: WKWebView, error: NSError) throws { + didFailNavigationArgs = [webViewArg, errorArg] + } + func didFailProvisionalNavigation(webView: WKWebView, error: NSError) throws { + didFailProvisionalNavigationArgs = [webViewArg, errorArg] + } + func webViewWebContentProcessDidTerminate(webView: WKWebView) throws { + webViewWebContentProcessDidTerminateArgs = [webViewArg] + } + func didReceiveAuthenticationChallenge(webView: WKWebView, challenge: URLAuthenticationChallenge) throws -> AuthenticationChallengeResponse { + didReceiveAuthenticationChallengeArgs = [webViewArg, challengeArg] + } +} +*/ + protocol PigeonApiDelegateNSObject { func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject /// Registers the observer object to receive KVO notifications for the key /// path relative to the object receiving this message. - func addObserver( - pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, - options: [KeyValueObservingOptions]) throws + func addObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, options: [KeyValueObservingOptions]) throws /// Stops the observer object from receiving change notifications for the /// property specified by the key path relative to the object receiving this /// message. - func removeObserver( - pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) - throws + func removeObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) throws } protocol PigeonApiProtocolNSObject { /// Informs the observing object when the value at the specified key path /// relative to the observed object has changed. - func observeValue( - pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, - object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, - completion: @escaping (Result) -> Void) + func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) } -final class PigeonApiNSObject: PigeonApiProtocolNSObject { +final class PigeonApiNSObject: PigeonApiProtocolNSObject { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSObject init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSObject) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSObject?) - { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSObject?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -4543,9 +5872,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let addObserverChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.addObserver", - binaryMessenger: binaryMessenger, codec: codec) + let addObserverChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.addObserver", binaryMessenger: binaryMessenger, codec: codec) if let api = api { addObserverChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -4554,9 +5881,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { let keyPathArg = args[2] as! String let optionsArg = args[3] as! [KeyValueObservingOptions] do { - try api.pigeonDelegate.addObserver( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, - keyPath: keyPathArg, options: optionsArg) + try api.pigeonDelegate.addObserver(pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, keyPath: keyPathArg, options: optionsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -4565,9 +5890,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } else { addObserverChannel.setMessageHandler(nil) } - let removeObserverChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.removeObserver", - binaryMessenger: binaryMessenger, codec: codec) + let removeObserverChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.removeObserver", binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeObserverChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -4575,9 +5898,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { let observerArg = args[1] as! NSObject let keyPathArg = args[2] as! String do { - try api.pigeonDelegate.removeObserver( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, - keyPath: keyPathArg) + try api.pigeonDelegate.removeObserver(pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, keyPath: keyPathArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -4589,26 +5910,21 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } ///Creates a Dart instance of NSObject and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: NSObject, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: NSObject, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -4627,11 +5943,7 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } /// Informs the observing object when the value at the specified key path /// relative to the observed object has changed. - func observeValue( - pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, - object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, - completion: @escaping (Result) -> Void - ) { + func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -4643,10 +5955,8 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.observeValue" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] as [Any?]) { - response in + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -4663,135 +5973,233 @@ final class PigeonApiNSObject: PigeonApiProtocolNSObject { } } + +/* +// 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 Foundation + + +/// Implementation of `NSObject` that calls to Dart in callback methods. +class ObjectImpl: NSObject { + let api: PigeonApiProtocolNSObject + + init(api: PigeonApiProtocolNSObject) { + self.api = api + } + + func fixMe() { + api.observeValue(pigeonInstance: self, keyPath: keyPath, object: object, change: change) { _ in } + } +} + +/// ProxyApi implementation for `NSObject`. +/// +/// 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 ObjectProxyAPIDelegate : PigeonApiDelegateNSObject { + func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject { + return NSObjectImpl(api: pigeonApi) + } + + func addObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, options: [KeyValueObservingOptions]) throws { + pigeonInstance.addObserver(observer: observer, keyPath: keyPath, options: options) + } + + func removeObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) throws { + pigeonInstance.removeObserver(observer: observer, keyPath: keyPath) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ObjectProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSObject(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testAddObserver() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSObject(registrar) + + let instance = TestObject() + let observer = TestObject + let keyPath = "myString" + let options = [.newValue] + api.pigeonDelegate.addObserver(pigeonApi: api, pigeonInstance: instance, observer: observer, keyPath: keyPath, options: options) + + XCTAssertEqual(instance.addObserverArgs, [observer, keyPath, options]) + } + + func testRemoveObserver() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSObject(registrar) + + let instance = TestObject() + let observer = TestObject + let keyPath = "myString" + api.pigeonDelegate.removeObserver(pigeonApi: api, pigeonInstance: instance, observer: observer, keyPath: keyPath) + + XCTAssertEqual(instance.removeObserverArgs, [observer, keyPath]) + } + + func testObserveValue() { + let api = TestObjectApi() + let instance = ObjectImpl(api: api) + let keyPath = "myString" + let object = TestObject + let change = [.indexes: -1] + instance.observeValue(keyPath: keyPath, object: object, change: change) + + XCTAssertEqual(api.observeValueArgs, [keyPath, object, change]) + } + +} +class TestObject: NSObject { + var addObserverArgs: [AnyHashable?]? = nil + var removeObserverArgs: [AnyHashable?]? = nil + + + override func addObserver() { + addObserverArgs = [observer, keyPath, options] + } + override func removeObserver() { + removeObserverArgs = [observer, keyPath] + } +} +class TestObjectApi: PigeonApiProtocolNSObject { + var observeValueArgs: [AnyHashable?]? = nil + + func observeValue(keyPath: String?, object: NSObject?, change: [KeyValueChangeKey: Any?]?) throws { + observeValueArgs = [keyPathArg, objectArg, changeArg] + } +} +*/ + protocol PigeonApiDelegateUIViewWKWebView { #if !os(macOS) - func pigeonDefaultConstructor( - pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration - ) throws -> WKWebView + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView #endif #if !os(macOS) - /// The object that contains the configuration details for the web view. - func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws - -> WKWebViewConfiguration + /// The object that contains the configuration details for the web view. + func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> WKWebViewConfiguration #endif #if !os(macOS) - /// The scroll view associated with the web view. - func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws - -> UIScrollView + /// The scroll view associated with the web view. + func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> UIScrollView #endif #if !os(macOS) - /// The object you use to integrate custom user interface elements, such as - /// contextual menus or panels, into web view interactions. - func setUIDelegate( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws + /// The object you use to integrate custom user interface elements, such as + /// contextual menus or panels, into web view interactions. + func setUIDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws #endif #if !os(macOS) - /// The object you use to manage navigation behavior for the web view. - func setNavigationDelegate( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate - ) throws + /// The object you use to manage navigation behavior for the web view. + func setNavigationDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws #endif #if !os(macOS) - /// The URL for the current webpage. - func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The URL for the current webpage. + func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// An estimate of what fraction of the current navigation has been loaded. - func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws - -> Double + /// An estimate of what fraction of the current navigation has been loaded. + func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Double #endif #if !os(macOS) - /// Loads the web content that the specified URL request object references and - /// navigates to that content. - func load( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) - throws + /// Loads the web content that the specified URL request object references and + /// navigates to that content. + func load(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws #endif #if !os(macOS) - /// Loads the contents of the specified HTML string and navigates to it. - func loadHtmlString( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, - baseUrl: String?) throws + /// Loads the contents of the specified HTML string and navigates to it. + func loadHtmlString(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws #endif #if !os(macOS) - /// Loads the web content from the specified file and navigates to it. - func loadFileUrl( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, - readAccessUrl: String) throws + /// Loads the web content from the specified file and navigates to it. + func loadFileUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws #endif #if !os(macOS) - /// Convenience method to load a Flutter asset. - func loadFlutterAsset( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws + /// Convenience method to load a Flutter asset. + func loadFlutterAsset(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws #endif #if !os(macOS) - /// A Boolean value that indicates whether there is a valid back item in the - /// back-forward list. - func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid back item in the + /// back-forward list. + func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(macOS) - /// A Boolean value that indicates whether there is a valid forward item in - /// the back-forward list. - func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid forward item in + /// the back-forward list. + func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(macOS) - /// Navigates to the back item in the back-forward list. - func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the back item in the back-forward list. + func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// Navigates to the forward item in the back-forward list. - func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the forward item in the back-forward list. + func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// Reloads the current webpage. - func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Reloads the current webpage. + func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// The page title. - func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The page title. + func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// A Boolean value that indicates whether horizontal swipe gestures trigger - /// backward and forward page navigation. - func setAllowsBackForwardNavigationGestures( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// A Boolean value that indicates whether horizontal swipe gestures trigger + /// backward and forward page navigation. + func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif #if !os(macOS) - /// The custom user agent string. - func setCustomUserAgent( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws + /// The custom user agent string. + func setCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws #endif #if !os(macOS) - /// Evaluates the specified JavaScript string. - func evaluateJavaScript( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, - completion: @escaping (Result) -> Void) + /// Evaluates the specified JavaScript string. + func evaluateJavaScript(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) #endif #if !os(macOS) - /// A Boolean value that indicates whether you can inspect the view with - /// Safari Web Inspector. - func setInspectable( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws + /// A Boolean value that indicates whether you can inspect the view with + /// Safari Web Inspector. + func setInspectable(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws #endif #if !os(macOS) - /// The custom user agent string. - func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws - -> String? + /// The custom user agent string. + func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// Whether to allow previews for link destinations and detected data such as - /// addresses and phone numbers. - /// - /// Defaults to true. - func setAllowsLinkPreview( - pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif } protocol PigeonApiProtocolUIViewWKWebView { } -final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { +final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIViewWKWebView ///An implementation of [UIView] used to access callback methods @@ -4804,673 +6212,1035 @@ final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiWKWebView(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateUIViewWKWebView - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIViewWKWebView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewWKWebView? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewWKWebView?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let initialConfigurationArg = args[1] as! WKWebViewConfiguration - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, initialConfiguration: initialConfigurationArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + let initialConfigurationArg = args[1] as! WKWebViewConfiguration + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: initialConfigurationArg), +withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let configurationChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.configuration", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - configurationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.configuration( - pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let configurationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.configuration", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + configurationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - configurationChannel.setMessageHandler(nil) } + } else { + configurationChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let scrollViewChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.scrollView", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - scrollViewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let scrollViewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.scrollView", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + scrollViewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - scrollViewChannel.setMessageHandler(nil) } + } else { + scrollViewChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setUIDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setUIDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setUIDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKUIDelegate - do { - try api.pigeonDelegate.setUIDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setUIDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setUIDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setUIDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKUIDelegate + do { + try api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setUIDelegateChannel.setMessageHandler(nil) } + } else { + setUIDelegateChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setNavigationDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setNavigationDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setNavigationDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKNavigationDelegate - do { - try api.pigeonDelegate.setNavigationDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setNavigationDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setNavigationDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setNavigationDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKNavigationDelegate + do { + try api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setNavigationDelegateChannel.setMessageHandler(nil) } + } else { + setNavigationDelegateChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let getUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getUrl", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getUrlChannel.setMessageHandler(nil) } + } else { + getUrlChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let getEstimatedProgressChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getEstimatedProgress", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getEstimatedProgressChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getEstimatedProgress( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getEstimatedProgressChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getEstimatedProgress", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEstimatedProgressChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getEstimatedProgressChannel.setMessageHandler(nil) } + } else { + getEstimatedProgressChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let loadChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.load", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let requestArg = args[1] as! URLRequestWrapper - do { - try api.pigeonDelegate.load( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.load", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let requestArg = args[1] as! URLRequestWrapper + do { + try api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadChannel.setMessageHandler(nil) } + } else { + loadChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let loadHtmlStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadHtmlString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadHtmlStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let stringArg = args[1] as! String - let baseUrlArg: String? = nilOrValue(args[2]) - do { - try api.pigeonDelegate.loadHtmlString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, - baseUrl: baseUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadHtmlStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadHtmlString", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadHtmlStringChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let stringArg = args[1] as! String + let baseUrlArg: String? = nilOrValue(args[2]) + do { + try api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, baseUrl: baseUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadHtmlStringChannel.setMessageHandler(nil) } + } else { + loadHtmlStringChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let loadFileUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFileUrl", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFileUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let urlArg = args[1] as! String - let readAccessUrlArg = args[2] as! String - do { - try api.pigeonDelegate.loadFileUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, - readAccessUrl: readAccessUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadFileUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFileUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFileUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let urlArg = args[1] as! String + let readAccessUrlArg = args[2] as! String + do { + try api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, readAccessUrl: readAccessUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadFileUrlChannel.setMessageHandler(nil) } + } else { + loadFileUrlChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let loadFlutterAssetChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFlutterAsset", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFlutterAssetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let keyArg = args[1] as! String - do { - try api.pigeonDelegate.loadFlutterAsset( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadFlutterAssetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFlutterAsset", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFlutterAssetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let keyArg = args[1] as! String + do { + try api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadFlutterAssetChannel.setMessageHandler(nil) } + } else { + loadFlutterAssetChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let canGoBackChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoBack", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoBack( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let canGoBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoBack", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - canGoBackChannel.setMessageHandler(nil) } + } else { + canGoBackChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let canGoForwardChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoForward", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoForward( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let canGoForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoForward", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - canGoForwardChannel.setMessageHandler(nil) } + } else { + canGoForwardChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let goBackChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goBack", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let goBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goBack", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - goBackChannel.setMessageHandler(nil) } + } else { + goBackChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let goForwardChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goForward", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let goForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goForward", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - goForwardChannel.setMessageHandler(nil) } + } else { + goForwardChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let reloadChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.reload", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - reloadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.reload", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - reloadChannel.setMessageHandler(nil) } + } else { + reloadChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let getTitleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getTitle", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getTitleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getTitle( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getTitleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getTitle", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getTitleChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getTitleChannel.setMessageHandler(nil) } + } else { + getTitleChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsBackForwardNavigationGestures", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsBackForwardNavigationGestures( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsBackForwardNavigationGestures", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) } + } else { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setCustomUserAgentChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setCustomUserAgent", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let userAgentArg: String? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setCustomUserAgent( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let userAgentArg: String? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setCustomUserAgentChannel.setMessageHandler(nil) } + } else { + setCustomUserAgentChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let evaluateJavaScriptChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.evaluateJavaScript", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - evaluateJavaScriptChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let javaScriptStringArg = args[1] as! String - api.pigeonDelegate.evaluateJavaScript( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } + let evaluateJavaScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.evaluateJavaScript", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + evaluateJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let javaScriptStringArg = args[1] as! String + api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) } } - } else { - evaluateJavaScriptChannel.setMessageHandler(nil) } + } else { + evaluateJavaScriptChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setInspectableChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setInspectable", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setInspectableChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let inspectableArg = args[1] as! Bool - do { - try api.pigeonDelegate.setInspectable( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setInspectableChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setInspectable", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setInspectableChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let inspectableArg = args[1] as! Bool + do { + try api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setInspectableChannel.setMessageHandler(nil) } + } else { + setInspectableChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let getCustomUserAgentChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getCustomUserAgent", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) + } #endif #if !os(macOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } #endif } - #if !os(macOS) - ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebView, 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.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(())) - } - } - } - } - #endif + #if !os(macOS) + ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + } + } + } + } + #endif +} + +/* +// 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 Foundation +import UIKit +import WebKit + + +/// ProxyApi implementation for `UIViewWKWebView`. +/// +/// 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 WebViewProxyAPIDelegate : PigeonApiDelegateUIViewWKWebView { + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView { + return UIViewWKWebView(,initialConfiguration: initialConfiguration) + } + + func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: UIViewWKWebView): WKWebViewConfiguration { + return pigeonInstance.configuration + } + + func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: UIViewWKWebView): UIScrollView { + return pigeonInstance.scrollView + } + + func setUIDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws { + pigeonInstance.uIDelegate = delegate: delegate + } + + func setNavigationDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws { + pigeonInstance.navigationDelegate = delegate: delegate + } + + func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.url + } + + func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Double { + return pigeonInstance.estimatedProgress + } + + func load(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws { + pigeonInstance.load(request: request) + } + + func loadHtmlString(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws { + pigeonInstance.loadHtmlString(string: string, baseUrl: baseUrl) + } + + func loadFileUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws { + pigeonInstance.loadFileUrl(url: url, readAccessUrl: readAccessUrl) + } + + func loadFlutterAsset(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws { + pigeonInstance.loadFlutterAsset(key: key) + } + + func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { + return pigeonInstance.canGoBack() + } + + func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { + return pigeonInstance.canGoForward() + } + + func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.goBack() + } + + func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.goForward() + } + + func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.reload() + } + + func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.title + } + + func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { + pigeonInstance.allowsBackForwardNavigationGestures = allow: allow + } + + func setCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws { + pigeonInstance.customUserAgent = userAgent: userAgent + } + + func evaluateJavaScript(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) { + return pigeonInstance.evaluateJavaScript(javaScriptString: javaScriptString) + } + + func setInspectable(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws { + pigeonInstance.inspectable = inspectable: inspectable + } + + func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.customUserAgent + } + + func setAllowsLinkPreview(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { + pigeonInstance.allowsLinkPreview = allow: allow + } + +} +*/ + +/* +// 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 UIKit +import WebKit +import Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebViewProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: TestWebViewConfiguration) + XCTAssertNotNil(instance) + } + + func testConfiguration() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = try? api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.configuration) + } + + func testScrollView() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = try? api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.scrollView) + } + + func testSetUIDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let delegate = TestUIDelegate + api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setUIDelegateArgs, [delegate]) + } + + func testSetNavigationDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let delegate = TestNavigationDelegate + api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setNavigationDelegateArgs, [delegate]) + } + + func testGetUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getUrlCalled) + XCTAssertEqual(value, instance.getUrl()) + } + + func testGetEstimatedProgress() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getEstimatedProgressCalled) + XCTAssertEqual(value, instance.getEstimatedProgress()) + } + + func testLoad() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let request = TestURLRequestWrapper + api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: instance, request: request) + + XCTAssertEqual(instance.loadArgs, [request]) + } + + func testLoadHtmlString() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let string = "myString" + let baseUrl = "myString" + api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: instance, string: string, baseUrl: baseUrl) + + XCTAssertEqual(instance.loadHtmlStringArgs, [string, baseUrl]) + } + + func testLoadFileUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let url = "myString" + let readAccessUrl = "myString" + api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: instance, url: url, readAccessUrl: readAccessUrl) + + XCTAssertEqual(instance.loadFileUrlArgs, [url, readAccessUrl]) + } + + func testLoadFlutterAsset() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let key = "myString" + api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: instance, key: key) + + XCTAssertEqual(instance.loadFlutterAssetArgs, [key]) + } + + func testCanGoBack() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.canGoBackCalled) + XCTAssertEqual(value, instance.canGoBack()) + } + + func testCanGoForward() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.canGoForwardCalled) + XCTAssertEqual(value, instance.canGoForward()) + } + + func testGoBack() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.goBackCalled) + } + + func testGoForward() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.goForwardCalled) + } + + func testReload() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.reloadCalled) + } + + func testGetTitle() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getTitleCalled) + XCTAssertEqual(value, instance.getTitle()) + } + + func testSetAllowsBackForwardNavigationGestures() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let allow = true + api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsBackForwardNavigationGesturesArgs, [allow]) + } + + func testSetCustomUserAgent() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let userAgent = "myString" + api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: instance, userAgent: userAgent) + + XCTAssertEqual(instance.setCustomUserAgentArgs, [userAgent]) + } + + func testEvaluateJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let javaScriptString = "myString" + let value = api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: instance, javaScriptString: javaScriptString) + + XCTAssertEqual(instance.evaluateJavaScriptArgs, [javaScriptString]) + XCTAssertEqual(value, instance.evaluateJavaScript(javaScriptString: javaScriptString)) + } + + func testSetInspectable() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let inspectable = true + api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: instance, inspectable: inspectable) + + XCTAssertEqual(instance.setInspectableArgs, [inspectable]) + } + + func testGetCustomUserAgent() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getCustomUserAgentCalled) + XCTAssertEqual(value, instance.getCustomUserAgent()) + } + + func testSetAllowsLinkPreview() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) + + let instance = TestWebView() + let allow = true + api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsLinkPreviewArgs, [allow]) + } + +} +class TestWebView: UIViewWKWebView { + private var configurationTestValue = TestWebViewConfiguration + private var scrollViewTestValue = TestScrollView + var setUIDelegateArgs: [AnyHashable?]? = nil + var setNavigationDelegateArgs: [AnyHashable?]? = nil + var getUrlCalled = false + var getEstimatedProgressCalled = false + var loadArgs: [AnyHashable?]? = nil + var loadHtmlStringArgs: [AnyHashable?]? = nil + var loadFileUrlArgs: [AnyHashable?]? = nil + var loadFlutterAssetArgs: [AnyHashable?]? = nil + var canGoBackCalled = false + var canGoForwardCalled = false + var goBackCalled = false + var goForwardCalled = false + var reloadCalled = false + var getTitleCalled = false + var setAllowsBackForwardNavigationGesturesArgs: [AnyHashable?]? = nil + var setCustomUserAgentArgs: [AnyHashable?]? = nil + var evaluateJavaScriptArgs: [AnyHashable?]? = nil + var setInspectableArgs: [AnyHashable?]? = nil + var getCustomUserAgentCalled = false + var setAllowsLinkPreviewArgs: [AnyHashable?]? = nil + + override var configuration: WKWebViewConfiguration { + return configurationTestValue + } + override var scrollView: UIScrollView { + return scrollViewTestValue + } + + override func setUIDelegate() { + setUIDelegateArgs = [delegate] + } + override func setNavigationDelegate() { + setNavigationDelegateArgs = [delegate] + } + override func getUrl() { + getUrlCalled = true + } + override func getEstimatedProgress() { + getEstimatedProgressCalled = true + } + override func load() { + loadArgs = [request] + } + override func loadHtmlString() { + loadHtmlStringArgs = [string, baseUrl] + } + override func loadFileUrl() { + loadFileUrlArgs = [url, readAccessUrl] + } + override func loadFlutterAsset() { + loadFlutterAssetArgs = [key] + } + override func canGoBack() { + canGoBackCalled = true + } + override func canGoForward() { + canGoForwardCalled = true + } + override func goBack() { + goBackCalled = true + } + override func goForward() { + goForwardCalled = true + } + override func reload() { + reloadCalled = true + } + override func getTitle() { + getTitleCalled = true + } + override func setAllowsBackForwardNavigationGestures() { + setAllowsBackForwardNavigationGesturesArgs = [allow] + } + override func setCustomUserAgent() { + setCustomUserAgentArgs = [userAgent] + } + override func evaluateJavaScript() { + evaluateJavaScriptArgs = [javaScriptString] + return -1 + } + override func setInspectable() { + setInspectableArgs = [inspectable] + } + override func getCustomUserAgent() { + getCustomUserAgentCalled = true + } + override func setAllowsLinkPreview() { + setAllowsLinkPreviewArgs = [allow] + } } +*/ + protocol PigeonApiDelegateNSViewWKWebView { #if !os(iOS) - func pigeonDefaultConstructor( - pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration - ) throws -> WKWebView + func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView #endif #if !os(iOS) - /// The object that contains the configuration details for the web view. - func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws - -> WKWebViewConfiguration + /// The object that contains the configuration details for the web view. + func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> WKWebViewConfiguration #endif #if !os(iOS) - /// The object you use to integrate custom user interface elements, such as - /// contextual menus or panels, into web view interactions. - func setUIDelegate( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws + /// The object you use to integrate custom user interface elements, such as + /// contextual menus or panels, into web view interactions. + func setUIDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws #endif #if !os(iOS) - /// The object you use to manage navigation behavior for the web view. - func setNavigationDelegate( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate - ) throws + /// The object you use to manage navigation behavior for the web view. + func setNavigationDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws #endif #if !os(iOS) - /// The URL for the current webpage. - func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The URL for the current webpage. + func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// An estimate of what fraction of the current navigation has been loaded. - func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws - -> Double + /// An estimate of what fraction of the current navigation has been loaded. + func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Double #endif #if !os(iOS) - /// Loads the web content that the specified URL request object references and - /// navigates to that content. - func load( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) - throws + /// Loads the web content that the specified URL request object references and + /// navigates to that content. + func load(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws #endif #if !os(iOS) - /// Loads the contents of the specified HTML string and navigates to it. - func loadHtmlString( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, - baseUrl: String?) throws + /// Loads the contents of the specified HTML string and navigates to it. + func loadHtmlString(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws #endif #if !os(iOS) - /// Loads the web content from the specified file and navigates to it. - func loadFileUrl( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, - readAccessUrl: String) throws + /// Loads the web content from the specified file and navigates to it. + func loadFileUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws #endif #if !os(iOS) - /// Convenience method to load a Flutter asset. - func loadFlutterAsset( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws + /// Convenience method to load a Flutter asset. + func loadFlutterAsset(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws #endif #if !os(iOS) - /// A Boolean value that indicates whether there is a valid back item in the - /// back-forward list. - func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid back item in the + /// back-forward list. + func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(iOS) - /// A Boolean value that indicates whether there is a valid forward item in - /// the back-forward list. - func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid forward item in + /// the back-forward list. + func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(iOS) - /// Navigates to the back item in the back-forward list. - func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the back item in the back-forward list. + func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// Navigates to the forward item in the back-forward list. - func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the forward item in the back-forward list. + func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// Reloads the current webpage. - func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Reloads the current webpage. + func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// The page title. - func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The page title. + func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// A Boolean value that indicates whether horizontal swipe gestures trigger - /// backward and forward page navigation. - func setAllowsBackForwardNavigationGestures( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// A Boolean value that indicates whether horizontal swipe gestures trigger + /// backward and forward page navigation. + func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif #if !os(iOS) - /// The custom user agent string. - func setCustomUserAgent( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws + /// The custom user agent string. + func setCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws #endif #if !os(iOS) - /// Evaluates the specified JavaScript string. - func evaluateJavaScript( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, - completion: @escaping (Result) -> Void) + /// Evaluates the specified JavaScript string. + func evaluateJavaScript(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) #endif #if !os(iOS) - /// A Boolean value that indicates whether you can inspect the view with - /// Safari Web Inspector. - func setInspectable( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws + /// A Boolean value that indicates whether you can inspect the view with + /// Safari Web Inspector. + func setInspectable(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws #endif #if !os(iOS) - /// The custom user agent string. - func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws - -> String? + /// The custom user agent string. + func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// Whether to allow previews for link destinations and detected data such as - /// addresses and phone numbers. - /// - /// Defaults to true. - func setAllowsLinkPreview( - pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif } protocol PigeonApiProtocolNSViewWKWebView { } -final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { +final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSViewWKWebView ///An implementation of [NSObject] used to access callback methods @@ -5483,534 +7253,901 @@ final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiWKWebView(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateNSViewWKWebView - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSViewWKWebView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSViewWKWebView? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSViewWKWebView?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(iOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let initialConfigurationArg = args[1] as! WKWebViewConfiguration - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor( - pigeonApi: api, initialConfiguration: initialConfigurationArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } - #endif - #if !os(iOS) - let configurationChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.configuration", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - configurationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.configuration( - pigeonApi: api, pigeonInstance: pigeonInstanceArg), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + let initialConfigurationArg = args[1] as! WKWebViewConfiguration + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: initialConfigurationArg), +withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - configurationChannel.setMessageHandler(nil) } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setUIDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setUIDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setUIDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKUIDelegate - do { - try api.pigeonDelegate.setUIDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let configurationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.configuration", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + configurationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setUIDelegateChannel.setMessageHandler(nil) } + } else { + configurationChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setNavigationDelegateChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setNavigationDelegate", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setNavigationDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKNavigationDelegate - do { - try api.pigeonDelegate.setNavigationDelegate( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setUIDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setUIDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setUIDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKUIDelegate + do { + try api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setNavigationDelegateChannel.setMessageHandler(nil) } + } else { + setUIDelegateChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let getUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getUrl", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let setNavigationDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setNavigationDelegate", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setNavigationDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKNavigationDelegate + do { + try api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - getUrlChannel.setMessageHandler(nil) } + } else { + setNavigationDelegateChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let getEstimatedProgressChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getEstimatedProgress", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getEstimatedProgressChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getEstimatedProgress( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - getEstimatedProgressChannel.setMessageHandler(nil) } + } else { + getUrlChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let loadChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.load", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let requestArg = args[1] as! URLRequestWrapper - do { - try api.pigeonDelegate.load( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let getEstimatedProgressChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getEstimatedProgress", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEstimatedProgressChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - loadChannel.setMessageHandler(nil) } + } else { + getEstimatedProgressChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let loadHtmlStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadHtmlString", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadHtmlStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let stringArg = args[1] as! String - let baseUrlArg: String? = nilOrValue(args[2]) - do { - try api.pigeonDelegate.loadHtmlString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, - baseUrl: baseUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.load", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let requestArg = args[1] as! URLRequestWrapper + do { + try api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadHtmlStringChannel.setMessageHandler(nil) } + } else { + loadChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let loadFileUrlChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFileUrl", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFileUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let urlArg = args[1] as! String - let readAccessUrlArg = args[2] as! String - do { - try api.pigeonDelegate.loadFileUrl( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, - readAccessUrl: readAccessUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadHtmlStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadHtmlString", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadHtmlStringChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let stringArg = args[1] as! String + let baseUrlArg: String? = nilOrValue(args[2]) + do { + try api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, baseUrl: baseUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadFileUrlChannel.setMessageHandler(nil) } + } else { + loadHtmlStringChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let loadFlutterAssetChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFlutterAsset", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFlutterAssetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let keyArg = args[1] as! String - do { - try api.pigeonDelegate.loadFlutterAsset( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let loadFileUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFileUrl", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFileUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let urlArg = args[1] as! String + let readAccessUrlArg = args[2] as! String + do { + try api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, readAccessUrl: readAccessUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - loadFlutterAssetChannel.setMessageHandler(nil) } + } else { + loadFileUrlChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let canGoBackChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoBack", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoBack( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let loadFlutterAssetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFlutterAsset", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFlutterAssetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let keyArg = args[1] as! String + do { + try api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - canGoBackChannel.setMessageHandler(nil) } + } else { + loadFlutterAssetChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let canGoForwardChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoForward", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoForward( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let canGoBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoBack", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - canGoForwardChannel.setMessageHandler(nil) } + } else { + canGoBackChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let goBackChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goBack", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let canGoForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoForward", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - goBackChannel.setMessageHandler(nil) } + } else { + canGoForwardChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let goForwardChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goForward", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let goBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goBack", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - goForwardChannel.setMessageHandler(nil) } + } else { + goBackChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let reloadChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.reload", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - reloadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let goForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goForward", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - reloadChannel.setMessageHandler(nil) } + } else { + goForwardChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let getTitleChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getTitle", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getTitleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getTitle( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.reload", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - getTitleChannel.setMessageHandler(nil) } + } else { + reloadChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsBackForwardNavigationGestures", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsBackForwardNavigationGestures( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let getTitleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getTitle", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getTitleChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) } - } else { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) } + } else { + getTitleChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setCustomUserAgentChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setCustomUserAgent", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let userAgentArg: String? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setCustomUserAgent( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsBackForwardNavigationGestures", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setCustomUserAgentChannel.setMessageHandler(nil) } + } else { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let evaluateJavaScriptChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.evaluateJavaScript", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - evaluateJavaScriptChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let javaScriptStringArg = args[1] as! String - api.pigeonDelegate.evaluateJavaScript( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg - ) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) - } - } + let setCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let userAgentArg: String? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - evaluateJavaScriptChannel.setMessageHandler(nil) } + } else { + setCustomUserAgentChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setInspectableChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setInspectable", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setInspectableChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let inspectableArg = args[1] as! Bool - do { - try api.pigeonDelegate.setInspectable( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) - reply(wrapResult(nil)) - } catch { + let evaluateJavaScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.evaluateJavaScript", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + evaluateJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let javaScriptStringArg = args[1] as! String + api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): reply(wrapError(error)) } } - } else { - setInspectableChannel.setMessageHandler(nil) } + } else { + evaluateJavaScriptChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let getCustomUserAgentChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getCustomUserAgent", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) - } + let setInspectableChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setInspectable", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setInspectableChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let inspectableArg = args[1] as! Bool + do { + try api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) } + } else { + setInspectableChannel.setMessageHandler(nil) + } #endif #if !os(iOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let getCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } + } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) + } + #endif + #if !os(iOS) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } #endif } #if !os(iOS) - ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebView, 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.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(())) - } + ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) } } } + } #endif } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `NSViewWKWebView`. +/// +/// 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 WebViewProxyAPIDelegate : PigeonApiDelegateNSViewWKWebView { + func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView { + return NSViewWKWebView(,initialConfiguration: initialConfiguration) + } + + func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: NSViewWKWebView): WKWebViewConfiguration { + return pigeonInstance.configuration + } + + func setUIDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws { + pigeonInstance.uIDelegate = delegate: delegate + } + + func setNavigationDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws { + pigeonInstance.navigationDelegate = delegate: delegate + } + + func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.url + } + + func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Double { + return pigeonInstance.estimatedProgress + } + + func load(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws { + pigeonInstance.load(request: request) + } + + func loadHtmlString(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws { + pigeonInstance.loadHtmlString(string: string, baseUrl: baseUrl) + } + + func loadFileUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws { + pigeonInstance.loadFileUrl(url: url, readAccessUrl: readAccessUrl) + } + + func loadFlutterAsset(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws { + pigeonInstance.loadFlutterAsset(key: key) + } + + func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { + return pigeonInstance.canGoBack() + } + + func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { + return pigeonInstance.canGoForward() + } + + func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.goBack() + } + + func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.goForward() + } + + func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { + pigeonInstance.reload() + } + + func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.title + } + + func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { + pigeonInstance.allowsBackForwardNavigationGestures = allow: allow + } + + func setCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws { + pigeonInstance.customUserAgent = userAgent: userAgent + } + + func evaluateJavaScript(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) { + return pigeonInstance.evaluateJavaScript(javaScriptString: javaScriptString) + } + + func setInspectable(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws { + pigeonInstance.inspectable = inspectable: inspectable + } + + func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { + return pigeonInstance.customUserAgent + } + + func setAllowsLinkPreview(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { + pigeonInstance.allowsLinkPreview = allow: allow + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebViewProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: TestWebViewConfiguration) + XCTAssertNotNil(instance) + } + + func testConfiguration() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = try? api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.configuration) + } + + func testSetUIDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let delegate = TestUIDelegate + api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setUIDelegateArgs, [delegate]) + } + + func testSetNavigationDelegate() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let delegate = TestNavigationDelegate + api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) + + XCTAssertEqual(instance.setNavigationDelegateArgs, [delegate]) + } + + func testGetUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getUrlCalled) + XCTAssertEqual(value, instance.getUrl()) + } + + func testGetEstimatedProgress() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getEstimatedProgressCalled) + XCTAssertEqual(value, instance.getEstimatedProgress()) + } + + func testLoad() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let request = TestURLRequestWrapper + api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: instance, request: request) + + XCTAssertEqual(instance.loadArgs, [request]) + } + + func testLoadHtmlString() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let string = "myString" + let baseUrl = "myString" + api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: instance, string: string, baseUrl: baseUrl) + + XCTAssertEqual(instance.loadHtmlStringArgs, [string, baseUrl]) + } + + func testLoadFileUrl() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let url = "myString" + let readAccessUrl = "myString" + api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: instance, url: url, readAccessUrl: readAccessUrl) + + XCTAssertEqual(instance.loadFileUrlArgs, [url, readAccessUrl]) + } + + func testLoadFlutterAsset() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let key = "myString" + api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: instance, key: key) + + XCTAssertEqual(instance.loadFlutterAssetArgs, [key]) + } + + func testCanGoBack() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.canGoBackCalled) + XCTAssertEqual(value, instance.canGoBack()) + } + + func testCanGoForward() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.canGoForwardCalled) + XCTAssertEqual(value, instance.canGoForward()) + } + + func testGoBack() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.goBackCalled) + } + + func testGoForward() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.goForwardCalled) + } + + func testReload() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.reloadCalled) + } + + func testGetTitle() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getTitleCalled) + XCTAssertEqual(value, instance.getTitle()) + } + + func testSetAllowsBackForwardNavigationGestures() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let allow = true + api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsBackForwardNavigationGesturesArgs, [allow]) + } + + func testSetCustomUserAgent() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let userAgent = "myString" + api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: instance, userAgent: userAgent) + + XCTAssertEqual(instance.setCustomUserAgentArgs, [userAgent]) + } + + func testEvaluateJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let javaScriptString = "myString" + let value = api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: instance, javaScriptString: javaScriptString) + + XCTAssertEqual(instance.evaluateJavaScriptArgs, [javaScriptString]) + XCTAssertEqual(value, instance.evaluateJavaScript(javaScriptString: javaScriptString)) + } + + func testSetInspectable() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let inspectable = true + api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: instance, inspectable: inspectable) + + XCTAssertEqual(instance.setInspectableArgs, [inspectable]) + } + + func testGetCustomUserAgent() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let value = api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getCustomUserAgentCalled) + XCTAssertEqual(value, instance.getCustomUserAgent()) + } + + func testSetAllowsLinkPreview() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) + + let instance = TestWebView() + let allow = true + api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsLinkPreviewArgs, [allow]) + } + +} +class TestWebView: NSViewWKWebView { + private var configurationTestValue = TestWebViewConfiguration + var setUIDelegateArgs: [AnyHashable?]? = nil + var setNavigationDelegateArgs: [AnyHashable?]? = nil + var getUrlCalled = false + var getEstimatedProgressCalled = false + var loadArgs: [AnyHashable?]? = nil + var loadHtmlStringArgs: [AnyHashable?]? = nil + var loadFileUrlArgs: [AnyHashable?]? = nil + var loadFlutterAssetArgs: [AnyHashable?]? = nil + var canGoBackCalled = false + var canGoForwardCalled = false + var goBackCalled = false + var goForwardCalled = false + var reloadCalled = false + var getTitleCalled = false + var setAllowsBackForwardNavigationGesturesArgs: [AnyHashable?]? = nil + var setCustomUserAgentArgs: [AnyHashable?]? = nil + var evaluateJavaScriptArgs: [AnyHashable?]? = nil + var setInspectableArgs: [AnyHashable?]? = nil + var getCustomUserAgentCalled = false + var setAllowsLinkPreviewArgs: [AnyHashable?]? = nil + + override var configuration: WKWebViewConfiguration { + return configurationTestValue + } + + override func setUIDelegate() { + setUIDelegateArgs = [delegate] + } + override func setNavigationDelegate() { + setNavigationDelegateArgs = [delegate] + } + override func getUrl() { + getUrlCalled = true + } + override func getEstimatedProgress() { + getEstimatedProgressCalled = true + } + override func load() { + loadArgs = [request] + } + override func loadHtmlString() { + loadHtmlStringArgs = [string, baseUrl] + } + override func loadFileUrl() { + loadFileUrlArgs = [url, readAccessUrl] + } + override func loadFlutterAsset() { + loadFlutterAssetArgs = [key] + } + override func canGoBack() { + canGoBackCalled = true + } + override func canGoForward() { + canGoForwardCalled = true + } + override func goBack() { + goBackCalled = true + } + override func goForward() { + goForwardCalled = true + } + override func reload() { + reloadCalled = true + } + override func getTitle() { + getTitleCalled = true + } + override func setAllowsBackForwardNavigationGestures() { + setAllowsBackForwardNavigationGesturesArgs = [allow] + } + override func setCustomUserAgent() { + setCustomUserAgentArgs = [userAgent] + } + override func evaluateJavaScript() { + evaluateJavaScriptArgs = [javaScriptString] + return -1 + } + override func setInspectable() { + setInspectableArgs = [inspectable] + } + override func getCustomUserAgent() { + getCustomUserAgentCalled = true + } + override func setAllowsLinkPreview() { + setAllowsLinkPreviewArgs = [allow] + } +} +*/ + open class PigeonApiDelegateWKWebView { } protocol PigeonApiProtocolWKWebView { } -final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { +final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebView ///An implementation of [NSObject] used to access callback methods @@ -6018,32 +8155,26 @@ final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebView) - { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebView) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKWebView, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKWebView, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -6067,35 +8198,19 @@ protocol PigeonApiDelegateWKUIDelegate { protocol PigeonApiProtocolWKUIDelegate { /// Creates a new web view. - func onCreateWebView( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - configuration configurationArg: WKWebViewConfiguration, - navigationAction navigationActionArg: WKNavigationAction, - completion: @escaping (Result) -> Void) + func onCreateWebView(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, configuration configurationArg: WKWebViewConfiguration, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. - func requestMediaCapturePermission( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, - completion: @escaping (Result) -> Void) + func requestMediaCapturePermission(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, completion: @escaping (Result) -> Void) /// Displays a JavaScript alert panel. - func runJavaScriptAlertPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - message messageArg: String, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void) + func runJavaScriptAlertPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) /// Displays a JavaScript confirm panel. - func runJavaScriptConfirmPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - message messageArg: String, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void) + func runJavaScriptConfirmPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) /// Displays a JavaScript text input panel. - func runJavaScriptTextInputPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void) + func runJavaScriptTextInputPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) } -final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { +final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUIDelegate ///An implementation of [NSObject] used to access callback methods @@ -6103,32 +8218,25 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUIDelegate - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUIDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUIDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUIDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -6140,34 +8248,25 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } ///Creates a Dart instance of WKUIDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKUIDelegate, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKUIDelegate, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + 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. - func onCreateWebView( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - configuration configurationArg: WKWebViewConfiguration, - navigationAction navigationActionArg: WKNavigationAction, - completion: @escaping (Result) -> Void - ) { + func onCreateWebView(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, configuration configurationArg: WKWebViewConfiguration, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6178,13 +8277,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.onCreateWebView" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [pigeonInstanceArg, webViewArg, configurationArg, navigationActionArg] as [Any?] - ) { response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.onCreateWebView" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, configurationArg, navigationActionArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6202,11 +8297,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. - func requestMediaCapturePermission( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, - completion: @escaping (Result) -> Void - ) { + func requestMediaCapturePermission(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6217,12 +8308,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, originArg, frameArg, typeArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, originArg, frameArg, typeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6233,11 +8321,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! PermissionDecision completion(.success(result)) @@ -6246,11 +8330,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } /// Displays a JavaScript alert panel. - func runJavaScriptAlertPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - message messageArg: String, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void - ) { + func runJavaScriptAlertPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6261,12 +8341,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptAlertPanel" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptAlertPanel" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6283,11 +8360,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } /// Displays a JavaScript confirm panel. - func runJavaScriptConfirmPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - message messageArg: String, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void - ) { + func runJavaScriptConfirmPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -6298,12 +8371,9 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { - response in + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -6314,11 +8384,7 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion( - .failure( - PigeonError( - code: "null-error", - message: "Flutter api returned null value for non-null return value.", details: ""))) + completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -6326,58 +8392,201 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { } } - /// Displays a JavaScript text input panel. - func runJavaScriptTextInputPanel( - pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, - prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptTextInputPanel" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage( - [pigeonInstanceArg, webViewArg, promptArg, defaultTextArg, frameArg] 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 { - let result: String? = nilOrValue(listResponse[0]) - completion(.success(result)) - } - } + /// Displays a JavaScript text input panel. + func runJavaScriptTextInputPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { + if pigeonRegistrar.ignoreCallsToDart { + completion( + .failure( + PigeonError( + code: "ignore-calls-error", + message: "Calls to Dart are being ignored.", details: ""))) + return + } + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptTextInputPanel" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, promptArg, defaultTextArg, frameArg] 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 { + let result: String? = nilOrValue(listResponse[0]) + completion(.success(result)) + } + } + } + +} + +/* +// 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 Foundation +import WebKit + +/// Implementation of `WKUIDelegate` that calls to Dart in callback methods. +class UIDelegateImpl: WKUIDelegate { + let api: PigeonApiProtocolWKUIDelegate + + init(api: PigeonApiProtocolWKUIDelegate) { + self.api = api + } + + func fixMe() { + api.onCreateWebView(pigeonInstance: self, webView: webView, configuration: configuration, navigationAction: navigationAction) { _ in } + } + + func fixMe() { + api.requestMediaCapturePermission(pigeonInstance: self, webView: webView, origin: origin, frame: frame, type: type) { _ in } + } + + func fixMe() { + api.runJavaScriptAlertPanel(pigeonInstance: self, webView: webView, message: message, frame: frame) { _ in } + } + + func fixMe() { + api.runJavaScriptConfirmPanel(pigeonInstance: self, webView: webView, message: message, frame: frame) { _ in } + } + + func fixMe() { + api.runJavaScriptTextInputPanel(pigeonInstance: self, webView: webView, prompt: prompt, defaultText: defaultText, frame: frame) { _ in } + } +} + +/// ProxyApi implementation for `WKUIDelegate`. +/// +/// 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 UIDelegateProxyAPIDelegate : PigeonApiDelegateWKUIDelegate { + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUIDelegate) throws -> WKUIDelegate { + return WKUIDelegateImpl(api: pigeonApi) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class UIDelegateProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKUIDelegate(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testOnCreateWebView() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let configuration = TestWebViewConfiguration + let navigationAction = TestNavigationAction + instance.onCreateWebView(webView: webView, configuration: configuration, navigationAction: navigationAction) + + XCTAssertEqual(api.onCreateWebViewArgs, [webView, configuration, navigationAction]) + } + + func testRequestMediaCapturePermission() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let origin = TestSecurityOrigin + let frame = TestFrameInfo + let type = .camera + instance.requestMediaCapturePermission(webView: webView, origin: origin, frame: frame, type: type) + + XCTAssertEqual(api.requestMediaCapturePermissionArgs, [webView, origin, frame, type]) + } + + func testRunJavaScriptAlertPanel() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let message = "myString" + let frame = TestFrameInfo + instance.runJavaScriptAlertPanel(webView: webView, message: message, frame: frame) + + XCTAssertEqual(api.runJavaScriptAlertPanelArgs, [webView, message, frame]) + } + + func testRunJavaScriptConfirmPanel() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let message = "myString" + let frame = TestFrameInfo + instance.runJavaScriptConfirmPanel(webView: webView, message: message, frame: frame) + + XCTAssertEqual(api.runJavaScriptConfirmPanelArgs, [webView, message, frame]) + } + + func testRunJavaScriptTextInputPanel() { + let api = TestUIDelegateApi() + let instance = UIDelegateImpl(api: api) + let webView = TestWebView + let prompt = "myString" + let defaultText = "myString" + let frame = TestFrameInfo + instance.runJavaScriptTextInputPanel(webView: webView, prompt: prompt, defaultText: defaultText, frame: frame) + + XCTAssertEqual(api.runJavaScriptTextInputPanelArgs, [webView, prompt, defaultText, frame]) } } +class TestUIDelegateApi: PigeonApiProtocolWKUIDelegate { + var onCreateWebViewArgs: [AnyHashable?]? = nil + var requestMediaCapturePermissionArgs: [AnyHashable?]? = nil + var runJavaScriptAlertPanelArgs: [AnyHashable?]? = nil + var runJavaScriptConfirmPanelArgs: [AnyHashable?]? = nil + var runJavaScriptTextInputPanelArgs: [AnyHashable?]? = nil + + func onCreateWebView(webView: WKWebView, configuration: WKWebViewConfiguration, navigationAction: WKNavigationAction) throws { + onCreateWebViewArgs = [webViewArg, configurationArg, navigationActionArg] + } + func requestMediaCapturePermission(webView: WKWebView, origin: WKSecurityOrigin, frame: WKFrameInfo, type: MediaCaptureType) throws -> PermissionDecision { + requestMediaCapturePermissionArgs = [webViewArg, originArg, frameArg, typeArg] + } + func runJavaScriptAlertPanel(webView: WKWebView, message: String, frame: WKFrameInfo) throws { + runJavaScriptAlertPanelArgs = [webViewArg, messageArg, frameArg] + } + func runJavaScriptConfirmPanel(webView: WKWebView, message: String, frame: WKFrameInfo) throws -> Bool { + runJavaScriptConfirmPanelArgs = [webViewArg, messageArg, frameArg] + } + func runJavaScriptTextInputPanel(webView: WKWebView, prompt: String, defaultText: String?, frame: WKFrameInfo) throws -> String? { + runJavaScriptTextInputPanelArgs = [webViewArg, promptArg, defaultTextArg, frameArg] + } +} +*/ + protocol PigeonApiDelegateWKHTTPCookieStore { /// Sets a cookie policy that indicates whether the cookie store allows cookie /// storage. - func setCookie( - pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, - completion: @escaping (Result) -> Void) + func setCookie(pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolWKHTTPCookieStore { } -final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { +final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKHTTPCookieStore ///An implementation of [NSObject] used to access callback methods @@ -6385,33 +8594,23 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKHTTPCookieStore - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKHTTPCookieStore) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKHTTPCookieStore? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKHTTPCookieStore?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setCookieChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.setCookie", - binaryMessenger: binaryMessenger, codec: codec) + let setCookieChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.setCookie", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setCookieChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKHTTPCookieStore let cookieArg = args[1] as! HTTPCookie - api.pigeonDelegate.setCookie( - pigeonApi: api, pigeonInstance: pigeonInstanceArg, cookie: cookieArg - ) { result in + api.pigeonDelegate.setCookie(pigeonApi: api, pigeonInstance: pigeonInstanceArg, cookie: cookieArg) { result in switch result { case .success: reply(wrapResult(nil)) @@ -6426,26 +8625,21 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } ///Creates a Dart instance of WKHTTPCookieStore and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: WKHTTPCookieStore, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: WKHTTPCookieStore, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -6463,29 +8657,80 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } } } + +/* +// 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 Foundation +import WebKit + + +/// ProxyApi implementation for `WKHTTPCookieStore`. +/// +/// 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 HTTPCookieStoreProxyAPIDelegate : PigeonApiDelegateWKHTTPCookieStore { + func setCookie(pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, completion: @escaping (Result) -> Void) { + pigeonInstance.cookie = cookie: cookie + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class HTTPCookieStoreProxyAPITests: XCTestCase { + func testSetCookie() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKHTTPCookieStore(registrar) + + let instance = TestHTTPCookieStore() + let cookie = TestHTTPCookie + api.pigeonDelegate.setCookie(pigeonApi: api, pigeonInstance: instance, cookie: cookie) + + XCTAssertEqual(instance.setCookieArgs, [cookie]) + } + +} +class TestHTTPCookieStore: WKHTTPCookieStore { + var setCookieArgs: [AnyHashable?]? = nil + + + override func setCookie() { + setCookieArgs = [cookie] + } +} +*/ + protocol PigeonApiDelegateUIScrollViewDelegate { #if !os(macOS) - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws - -> UIScrollViewDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate #endif } protocol PigeonApiProtocolUIScrollViewDelegate { #if !os(macOS) - /// Tells the delegate when the user scrolls the content view within the - /// scroll view. - /// - /// Note that this is a convenient method that includes the `contentOffset` of - /// the `scrollView`. - func scrollViewDidScroll( - pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, - scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, - completion: @escaping (Result) -> Void) - #endif + /// Tells the delegate when the user scrolls the content view within the + /// scroll view. + /// + /// Note that this is a convenient method that includes the `contentOffset` of + /// the `scrollView`. + func scrollViewDidScroll(pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, completion: @escaping (Result) -> Void) #endif } -final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate { +final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIScrollViewDelegate ///An implementation of [NSObject] used to access callback methods @@ -6493,112 +8738,55 @@ final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateUIScrollViewDelegate - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollViewDelegate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollViewDelegate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollViewDelegate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_defaultConstructor", - binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), - withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( +try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), +withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) + } #endif } #if !os(macOS) - ///Creates a Dart instance of UIScrollViewDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: UIScrollViewDelegate, - 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.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(())) - } - } - } - } - #endif - #if !os(macOS) - /// Tells the delegate when the user scrolls the content view within the - /// scroll view. - /// - /// Note that this is a convenient method that includes the `contentOffset` of - /// the `scrollView`. - func scrollViewDidScroll( - pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, - scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, - completion: @escaping (Result) -> Void - ) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } + ///Creates a Dart instance of UIScrollViewDelegate and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: UIScrollViewDelegate, 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.UIScrollViewDelegate.scrollViewDidScroll" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, scrollViewArg, xArg, yArg] as [Any?]) { response in + 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 @@ -6613,22 +8801,144 @@ final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate } } } + } + #endif + #if !os(macOS) + /// Tells the delegate when the user scrolls the content view within the + /// scroll view. + /// + /// Note that this is a convenient method that includes the `contentOffset` of + /// the `scrollView`. + func scrollViewDidScroll(pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, completion: @escaping (Result) -> Void) { + if pigeonRegistrar.ignoreCallsToDart { + completion( + .failure( + PigeonError( + code: "ignore-calls-error", + message: "Calls to Dart are being ignored.", details: ""))) + return + } + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.scrollViewDidScroll" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, scrollViewArg, xArg, yArg] 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(())) + } + } + } #endif } + +/* +// 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 Foundation +import UIKit + +/// Implementation of `UIScrollViewDelegate` that calls to Dart in callback methods. +class ScrollViewDelegateImpl: UIScrollViewDelegate { + let api: PigeonApiProtocolUIScrollViewDelegate + + init(api: PigeonApiProtocolUIScrollViewDelegate) { + self.api = api + } + + func fixMe() { + api.scrollViewDidScroll(pigeonInstance: self, scrollView: scrollView, x: x, y: y) { _ in } + } +} + +/// ProxyApi implementation for `UIScrollViewDelegate`. +/// +/// 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 ScrollViewDelegateProxyAPIDelegate : PigeonApiDelegateUIScrollViewDelegate { + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate { + return UIScrollViewDelegateImpl(api: pigeonApi) + } + +} +*/ + +/* +// 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 UIKit +import Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class ScrollViewDelegateProxyAPITests: XCTestCase { + func testPigeonDefaultConstructor() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiUIScrollViewDelegate(registrar) + + let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) + XCTAssertNotNil(instance) + } + + func testScrollViewDidScroll() { + let api = TestScrollViewDelegateApi() + let instance = ScrollViewDelegateImpl(api: api) + let scrollView = TestScrollView + let x = 1.0 + let y = 1.0 + instance.scrollViewDidScroll(scrollView: scrollView, x: x, y: y) + + XCTAssertEqual(api.scrollViewDidScrollArgs, [scrollView, x, y]) + } + +} +class TestScrollViewDelegateApi: PigeonApiProtocolUIScrollViewDelegate { + var scrollViewDidScrollArgs: [AnyHashable?]? = nil + + func scrollViewDidScroll(scrollView: UIScrollView, x: Double, y: Double) throws { + scrollViewDidScrollArgs = [scrollViewArg, xArg, yArg] + } +} +*/ + protocol PigeonApiDelegateURLCredential { /// Creates a URL credential instance for internet password authentication /// with a given user name and password, using a given persistence setting. - func withUser( - pigeonApi: PigeonApiURLCredential, user: String, password: String, - persistence: UrlCredentialPersistence - ) throws -> URLCredential + func withUser(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence) throws -> URLCredential + /// Creates a URL credential instance for internet password authentication + /// with a given user name and password, using a given persistence setting. + /// + /// This provides the native `UrlCredential(user:password:persistence)` + /// constructor as an async method to ensure the class is added to the + /// InstanceManager. See https://github.com/flutter/flutter/issues/162437. + func withUserAsync(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence, completion: @escaping (Result) -> Void) + /// Creates a URL credential instance for server trust authentication, + /// initialized with a accepted trust. + /// + /// This provides the native `UrlCredential(forTrust:)` constructor as an + /// async method to ensure the class is added to the InstanceManager. See + /// https://github.com/flutter/flutter/issues/162437. + func serverTrustAsync(pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolURLCredential { } -final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { +final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLCredential ///An implementation of [NSObject] used to access callback methods @@ -6636,24 +8946,17 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLCredential - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLCredential) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLCredential? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLCredential?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let withUserChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUser", - binaryMessenger: binaryMessenger, codec: codec) + let withUserChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUser", binaryMessenger: binaryMessenger, codec: codec) if let api = api { withUserChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6663,9 +8966,8 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { let persistenceArg = args[3] as! UrlCredentialPersistence do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( - try api.pigeonDelegate.withUser( - pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg), - withIdentifier: pigeonIdentifierArg) +try api.pigeonDelegate.withUser(pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg), +withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -6674,29 +8976,60 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { } else { withUserChannel.setMessageHandler(nil) } + let withUserAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUserAsync", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + withUserAsyncChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let userArg = args[0] as! String + let passwordArg = args[1] as! String + let persistenceArg = args[2] as! UrlCredentialPersistence + api.pigeonDelegate.withUserAsync(pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + withUserAsyncChannel.setMessageHandler(nil) + } + let serverTrustAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.serverTrustAsync", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + serverTrustAsyncChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let trustArg = args[0] as! SecTrustWrapper + api.pigeonDelegate.serverTrustAsync(pigeonApi: api, trust: trustArg) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } + } + } + } else { + serverTrustAsyncChannel.setMessageHandler(nil) + } } ///Creates a Dart instance of URLCredential and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLCredential, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLCredential, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -6714,29 +9047,76 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URLCredential`. +/// +/// 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 URLCredentialProxyAPIDelegate : PigeonApiDelegateURLCredential { + func withUser(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence) throws -> URLCredential { + return URLCredential(,user: user, password: password, persistence: persistence) + } + + func withUserAsync(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence, completion: @escaping (Result) -> Void) { + return URLCredential.withUserAsync(user: user, password: password, persistence: persistence) + } + + func serverTrustAsync(pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) { + return URLCredential.serverTrustAsync(trust: trust) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLCredentialProxyAPITests: XCTestCase { + func testWithUser() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLCredential(registrar) + + let instance = try? api.pigeonDelegate.withUser(pigeonApi: api, user: "myString", password: "myString", persistence: .none) + XCTAssertNotNil(instance) + } + +} +*/ + protocol PigeonApiDelegateURLProtectionSpace { /// The receiver’s host. - func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws - -> String + func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String /// The receiver’s port. - func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws - -> Int64 + func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> Int64 /// The receiver’s authentication realm. - func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws - -> String? + func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? /// The authentication method used by the receiver. - func authenticationMethod( - pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace - ) throws -> String? + func authenticationMethod(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? /// A representation of the server’s SSL transaction state. - func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) - throws -> SecTrustWrapper? + func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> SecTrustWrapper? } protocol PigeonApiProtocolURLProtectionSpace { } -final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { +final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLProtectionSpace ///An implementation of [NSObject] used to access callback methods @@ -6744,32 +9124,23 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateURLProtectionSpace - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLProtectionSpace) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getServerTrustChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", - binaryMessenger: binaryMessenger, codec: codec) + let getServerTrustChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getServerTrustChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLProtectionSpace do { - let result = try api.pigeonDelegate.getServerTrust( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getServerTrust(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -6781,34 +9152,26 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } ///Creates a Dart instance of URLProtectionSpace and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLProtectionSpace, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLProtectionSpace, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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 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 + 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 @@ -6825,17 +9188,143 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URLProtectionSpace`. +/// +/// 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 URLProtectionSpaceProxyAPIDelegate : PigeonApiDelegateURLProtectionSpace { + func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String { + return pigeonInstance.host + } + + func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> Int64 { + return pigeonInstance.port + } + + func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? { + return pigeonInstance.realm + } + + func authenticationMethod(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? { + return pigeonInstance.authenticationMethod + } + + func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> SecTrustWrapper? { + return pigeonInstance.serverTrust + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLProtectionSpaceProxyAPITests: XCTestCase { + func testHost() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = try? api.pigeonDelegate.host(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.host) + } + + func testPort() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = try? api.pigeonDelegate.port(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.port) + } + + func testRealm() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = try? api.pigeonDelegate.realm(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.realm) + } + + func testAuthenticationMethod() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = try? api.pigeonDelegate.authenticationMethod(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.authenticationMethod) + } + + func testGetServerTrust() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) + + let instance = TestURLProtectionSpace() + let value = api.pigeonDelegate.getServerTrust(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getServerTrustCalled) + XCTAssertEqual(value, instance.getServerTrust()) + } + +} +class TestURLProtectionSpace: URLProtectionSpace { + private var hostTestValue = "myString" + private var portTestValue = 0 + private var realmTestValue = "myString" + private var authenticationMethodTestValue = "myString" + var getServerTrustCalled = false + + override var host: String { + return hostTestValue + } + override var port: Int64 { + return portTestValue + } + override var realm: String { + return realmTestValue + } + override var authenticationMethod: String { + return authenticationMethodTestValue + } + + override func getServerTrust() { + getServerTrustCalled = true + } +} +*/ + protocol PigeonApiDelegateURLAuthenticationChallenge { /// The receiver’s protection space. - func getProtectionSpace( - pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge - ) throws -> URLProtectionSpace + func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace } protocol PigeonApiProtocolURLAuthenticationChallenge { } -final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticationChallenge { +final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticationChallenge { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLAuthenticationChallenge ///An implementation of [NSObject] used to access callback methods @@ -6843,33 +9332,23 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateURLAuthenticationChallenge - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLAuthenticationChallenge) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLAuthenticationChallenge? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLAuthenticationChallenge?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getProtectionSpaceChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.getProtectionSpace", - binaryMessenger: binaryMessenger, codec: codec) + let getProtectionSpaceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.getProtectionSpace", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getProtectionSpaceChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLAuthenticationChallenge do { - let result = try api.pigeonDelegate.getProtectionSpace( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getProtectionSpace(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -6881,27 +9360,21 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat } ///Creates a Dart instance of URLAuthenticationChallenge and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URLAuthenticationChallenge, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URLAuthenticationChallenge, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -6919,6 +9392,62 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URLAuthenticationChallenge`. +/// +/// 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 URLAuthenticationChallengeProxyAPIDelegate : PigeonApiDelegateURLAuthenticationChallenge { + func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace { + return pigeonInstance.protectionSpace + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLAuthenticationChallengeProxyAPITests: XCTestCase { + func testGetProtectionSpace() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURLAuthenticationChallenge(registrar) + + let instance = TestURLAuthenticationChallenge() + let value = api.pigeonDelegate.getProtectionSpace(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getProtectionSpaceCalled) + XCTAssertEqual(value, instance.getProtectionSpace()) + } + +} +class TestURLAuthenticationChallenge: URLAuthenticationChallenge { + var getProtectionSpaceCalled = false + + + override func getProtectionSpace() { + getProtectionSpaceCalled = true + } +} +*/ + protocol PigeonApiDelegateURL { /// The absolute string for the URL. func getAbsoluteString(pigeonApi: PigeonApiURL, pigeonInstance: URL) throws -> String @@ -6927,7 +9456,7 @@ protocol PigeonApiDelegateURL { protocol PigeonApiProtocolURL { } -final class PigeonApiURL: PigeonApiProtocolURL { +final class PigeonApiURL: PigeonApiProtocolURL { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURL ///An implementation of [NSObject] used to access callback methods @@ -6943,19 +9472,15 @@ final class PigeonApiURL: PigeonApiProtocolURL { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getAbsoluteStringChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.URL.getAbsoluteString", - binaryMessenger: binaryMessenger, codec: codec) + let getAbsoluteStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URL.getAbsoluteString", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAbsoluteStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URL do { - let result = try api.pigeonDelegate.getAbsoluteString( - pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAbsoluteString(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -6967,26 +9492,21 @@ final class PigeonApiURL: PigeonApiProtocolURL { } ///Creates a Dart instance of URL and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: URL, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: URL, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -7004,19 +9524,73 @@ final class PigeonApiURL: PigeonApiProtocolURL { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `URL`. +/// +/// 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 URLProxyAPIDelegate : PigeonApiDelegateURL { + func getAbsoluteString(pigeonApi: PigeonApiURL, pigeonInstance: URL) throws -> String { + return pigeonInstance.absoluteString + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class URLProxyAPITests: XCTestCase { + func testGetAbsoluteString() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiURL(registrar) + + let instance = TestURL() + let value = api.pigeonDelegate.getAbsoluteString(pigeonApi: api, pigeonInstance: instance ) + + XCTAssertTrue(instance.getAbsoluteStringCalled) + XCTAssertEqual(value, instance.getAbsoluteString()) + } + +} +class TestURL: URL { + var getAbsoluteStringCalled = false + + + override func getAbsoluteString() { + getAbsoluteStringCalled = true + } +} +*/ + 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 + func setAllowsContentJavaScript(pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) throws } protocol PigeonApiProtocolWKWebpagePreferences { } -final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { +final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebpagePreferences ///An implementation of [NSObject] used to access callback methods @@ -7024,35 +9598,25 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateWKWebpagePreferences - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebpagePreferences) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + 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) + 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) + try api.pigeonDelegate.setAllowsContentJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -7061,21 +9625,16 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } else { setAllowsContentJavaScriptChannel.setMessageHandler(nil) } - } else { + } else { let setAllowsContentJavaScriptChannel = FlutterBasicMessageChannel( - name: - "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.setAllowsContentJavaScript", + 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 - ))) + reply(wrapError(FlutterError(code: "PigeonUnsupportedOperationError", + message: "Call to setAllowsContentJavaScript requires @available(iOS 13.0.0, macOS 10.15.0, *).", + details: nil + ))) } } else { setAllowsContentJavaScriptChannel.setMessageHandler(nil) @@ -7085,26 +9644,21 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences ///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 - ) { + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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) + 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))) @@ -7122,22 +9676,75 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } } } + +/* +// 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 Foundation +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 { + func setAllowsContentJavaScript(pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) throws { + pigeonInstance.allowsContentJavaScript = allow: allow + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class WebpagePreferencesProxyAPITests: XCTestCase { + func testSetAllowsContentJavaScript() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiWKWebpagePreferences(registrar) + + let instance = TestWebpagePreferences() + let allow = true + api.pigeonDelegate.setAllowsContentJavaScript(pigeonApi: api, pigeonInstance: instance, allow: allow) + + XCTAssertEqual(instance.setAllowsContentJavaScriptArgs, [allow]) + } + +} +class TestWebpagePreferences: WKWebpagePreferences { + var setAllowsContentJavaScriptArgs: [AnyHashable?]? = nil + + + override func setAllowsContentJavaScript() { + setAllowsContentJavaScriptArgs = [allow] + } +} +*/ + protocol PigeonApiDelegateGetTrustResultResponse { /// The result code from the most recent trust evaluation. - func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) - throws -> DartSecTrustResultType + func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType /// A result code. /// /// See https://developer.apple.com/documentation/security/security-framework-result-codes?language=objc. - func resultCode( - pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse - ) throws -> Int64 + func resultCode(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> Int64 } protocol PigeonApiProtocolGetTrustResultResponse { } -final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResponse { +final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateGetTrustResultResponse ///An implementation of [NSObject] used to access callback methods @@ -7145,38 +9752,28 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, - delegate: PigeonApiDelegateGetTrustResultResponse - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateGetTrustResultResponse) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of GetTrustResultResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: GetTrustResultResponse, - completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: GetTrustResultResponse, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) let resultArg = try! pigeonDelegate.result(pigeonApi: self, pigeonInstance: pigeonInstance) - let resultCodeArg = try! pigeonDelegate.resultCode( - pigeonApi: self, pigeonInstance: pigeonInstance) + let resultCodeArg = try! pigeonDelegate.resultCode(pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = - "dev.flutter.pigeon.webview_flutter_wkwebview.GetTrustResultResponse.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.GetTrustResultResponse.pigeon_newInstance" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, resultArg, resultCodeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -7194,32 +9791,105 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `GetTrustResultResponse`. +/// +/// 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 GetTrustResultResponseProxyAPIDelegate : PigeonApiDelegateGetTrustResultResponse { + func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType { + switch pigeonInstance.result { + case .unspecified: + return .unspecified + case .proceed: + return .proceed + case .deny: + return .deny + case .recoverableTrustFailure: + return .recoverableTrustFailure + case .fatalTrustFailure: + return .fatalTrustFailure + case .otherError: + return .otherError + case .invalid: + return .invalid + case .confirm: + return .confirm + @unknown default: + return .unknown + } + } + + func resultCode(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> Int64 { + return pigeonInstance.resultCode + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class GetTrustResultResponseProxyAPITests: XCTestCase { + func testResult() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiGetTrustResultResponse(registrar) + + let instance = TestGetTrustResultResponse() + let value = try? api.pigeonDelegate.result(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.result) + } + + func testResultCode() { + let registrar = TestProxyApiRegistrar() + let api = registrar.apiDelegate.pigeonApiGetTrustResultResponse(registrar) + + let instance = TestGetTrustResultResponse() + let value = try? api.pigeonDelegate.resultCode(pigeonApi: api, pigeonInstance: instance) + + XCTAssertEqual(value, instance.resultCode) + } + +} +*/ + protocol PigeonApiDelegateSecTrust { /// Evaluates trust for the specified certificate and policies. - func evaluateWithError( - pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, - completion: @escaping (Result) -> Void) + func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) /// Returns an opaque cookie containing exceptions to trust policies that will /// allow future evaluations of the current certificate to succeed. - func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws - -> FlutterStandardTypedData? + func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> FlutterStandardTypedData? /// Sets a list of exceptions that should be ignored when the certificate is /// evaluated. - func setExceptions( - pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData? - ) throws -> Bool + func setExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData?) throws -> Bool /// Returns the result code from the most recent trust evaluation. - func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws - -> GetTrustResultResponse + func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> GetTrustResultResponse /// Certificates used to evaluate trust. - func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws - -> [SecCertificateWrapper]? + func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> [SecCertificateWrapper]? } protocol PigeonApiProtocolSecTrust { } -final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { +final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateSecTrust ///An implementation of [NSObject] used to access callback methods @@ -7231,17 +9901,13 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecTrust?) - { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecTrust?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let evaluateWithErrorChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.evaluateWithError", - binaryMessenger: binaryMessenger, codec: codec) + let evaluateWithErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.evaluateWithError", binaryMessenger: binaryMessenger, codec: codec) if let api = api { evaluateWithErrorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7258,9 +9924,7 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { evaluateWithErrorChannel.setMessageHandler(nil) } - let copyExceptionsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyExceptions", - binaryMessenger: binaryMessenger, codec: codec) + let copyExceptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyExceptions", binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyExceptionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7275,17 +9939,14 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { copyExceptionsChannel.setMessageHandler(nil) } - let setExceptionsChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.setExceptions", - binaryMessenger: binaryMessenger, codec: codec) + let setExceptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.setExceptions", binaryMessenger: binaryMessenger, codec: codec) if let api = api { setExceptionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let trustArg = args[0] as! SecTrustWrapper let exceptionsArg: FlutterStandardTypedData? = nilOrValue(args[1]) do { - let result = try api.pigeonDelegate.setExceptions( - pigeonApi: api, trust: trustArg, exceptions: exceptionsArg) + let result = try api.pigeonDelegate.setExceptions(pigeonApi: api, trust: trustArg, exceptions: exceptionsArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -7294,9 +9955,7 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { setExceptionsChannel.setMessageHandler(nil) } - let getTrustResultChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.getTrustResult", - binaryMessenger: binaryMessenger, codec: codec) + let getTrustResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.getTrustResult", binaryMessenger: binaryMessenger, codec: codec) if let api = api { getTrustResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7311,9 +9970,7 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { getTrustResultChannel.setMessageHandler(nil) } - let copyCertificateChainChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyCertificateChain", - binaryMessenger: binaryMessenger, codec: codec) + let copyCertificateChainChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyCertificateChain", binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyCertificateChainChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7331,26 +9988,21 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } ///Creates a Dart instance of SecTrust and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: SecTrustWrapper, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: SecTrustWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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.SecTrust.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.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))) @@ -7368,16 +10020,68 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `SecTrust`. +/// +/// 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 SecTrustWrapperProxyAPIDelegate : PigeonApiDelegateSecTrust { + func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) { + return SecTrust.evaluateWithError(trust: trust) + } + + func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> FlutterStandardTypedData? { + return SecTrust.copyExceptions(trust: trust) + } + + func setExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData?) throws -> Bool { + return SecTrust.setExceptions(trust: trust, exceptions: exceptions) + } + + func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> GetTrustResultResponse { + return SecTrust.getTrustResult(trust: trust) + } + + func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> [SecCertificateWrapper]? { + return SecTrust.copyCertificateChain(trust: trust) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class SecTrustWrapperProxyAPITests: XCTestCase { +} +*/ + protocol PigeonApiDelegateSecCertificate { /// Returns a DER representation of a certificate given a certificate object. - func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws - -> FlutterStandardTypedData + func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData } protocol PigeonApiProtocolSecCertificate { } -final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { +final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateSecCertificate ///An implementation of [NSObject] used to access callback methods @@ -7385,24 +10089,17 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init( - pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateSecCertificate - ) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateSecCertificate) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers( - binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecCertificate? - ) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecCertificate?) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( - pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let copyDataChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.copyData", - binaryMessenger: binaryMessenger, codec: codec) + let copyDataChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.copyData", binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyDataChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -7420,26 +10117,21 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { } ///Creates a Dart instance of SecCertificate and attaches it to [pigeonInstance]. - func pigeonNewInstance( - pigeonInstance: SecCertificateWrapper, completion: @escaping (Result) -> Void - ) { + func pigeonNewInstance(pigeonInstance: SecCertificateWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( - pigeonInstance as AnyObject) + } 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.SecCertificate.pigeon_newInstance" - let channel = FlutterBasicMessageChannel( - name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.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))) @@ -7457,3 +10149,40 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { } } } + +/* +// 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 Foundation + + + +/// ProxyApi implementation for `SecCertificate`. +/// +/// 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 SecCertificateWrapperProxyAPIDelegate : PigeonApiDelegateSecCertificate { + func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData { + return SecCertificate.copyData(certificate: certificate) + } + +} +*/ + +/* +// 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 Flutter +import XCTest + +@testable import webview_flutter_wkwebview + +class SecCertificateWrapperProxyAPITests: XCTestCase { +} +*/ + diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart index 3bd0a5382ac8..63f48d86f195 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart @@ -199,6 +199,10 @@ Page resource error: }) ..setOnHttpAuthRequest((HttpAuthRequest request) { openDialog(request); + }) + ..setOnSSlAuthError((PlatformSslAuthError error) { + debugPrint('SSL error from ${(error as WebKitSslAuthError).host}'); + error.proceed(); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( @@ -475,7 +479,7 @@ class SampleMenu extends StatelessWidget { Future _loadFlutterDev() { return webViewController.loadRequest(LoadRequestParams( - uri: Uri.parse('https://flutter.dev'), + uri: Uri.parse('https://expired.badssl.com/'), )); } 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 c6a9598d1e0a..991a6d6a2860 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 @@ -8,8 +8,7 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' - show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -20,8 +19,7 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse( - {Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -30,7 +28,6 @@ List wrapResponse( } return [error.code, error.message, error.details]; } - /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -113,10 +110,9 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> - _weakInstances = >{}; - final Map _strongInstances = - {}; + final Map> _weakInstances = + >{}; + final Map _strongInstances = {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -126,8 +122,7 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = - _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -135,76 +130,42 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.setUpMessageHandlers( - instanceManager: instanceManager); - URLRequest.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - HTTPURLResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - URLResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKUserScript.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKNavigationAction.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKNavigationResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKFrameInfo.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - NSError.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKScriptMessage.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKSecurityOrigin.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - HTTPCookie.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - AuthenticationChallengeResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKWebsiteDataStore.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + _PigeonInternalInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); + URLRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + HTTPURLResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + URLResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKUserScript.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKNavigationAction.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKNavigationResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKFrameInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + NSError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKScriptMessage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKSecurityOrigin.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + HTTPCookie.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + AuthenticationChallengeResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebsiteDataStore.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); UIView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIScrollView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKWebViewConfiguration.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKUserContentController.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKPreferences.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKScriptMessageHandler.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKNavigationDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - NSObject.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - UIViewWKWebView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - NSViewWKWebView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKWebView.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKUIDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - WKHTTPCookieStore.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - UIScrollViewDelegate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - URLCredential.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - URLProtectionSpace.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - URLAuthenticationChallenge.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + UIScrollView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebViewConfiguration.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKUserContentController.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKPreferences.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKScriptMessageHandler.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKNavigationDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + NSObject.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + UIViewWKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + NSViewWKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKUIDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKHTTPCookieStore.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + UIScrollViewDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + URLCredential.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + URLProtectionSpace.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + URLAuthenticationChallenge.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); URL.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebpagePreferences.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - GetTrustResultResponse.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - SecTrust.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); - SecCertificate.pigeon_setUpMessageHandlers( - pigeon_instanceManager: instanceManager); + WKWebpagePreferences.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + GetTrustResultResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + SecTrust.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + SecCertificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); return instanceManager; } @@ -268,20 +229,15 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference( - int identifier) { - final PigeonInternalProxyApiBaseClass? weakInstance = - _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference(int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = - _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = - strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass copy = strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = - WeakReference(copy); + _weakInstances[identifier] = WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -305,20 +261,17 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier( - PigeonInternalProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = - WeakReference(instance); + _weakInstances[identifier] = WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); @@ -445,30 +398,322 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } + const _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } +} - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } +/// Handles constructing objects and calling static methods for the Android +/// Interactive Media Ads native library. +/// +/// This class provides dependency injection for the implementations of the +/// platform interface classes. Improving the ease of unit testing and/or +/// overriding the underlying Android classes. +/// +/// By default each function calls the default constructor of the class it +/// intends to return. +class WebKitGProxy { + /// Constructs an [WebKitGProxy]. + const WebKitGProxy({ + this.newURLRequest = URLRequest.new, + this.newWKUserScript = WKUserScript.new, + this.newHTTPCookie = HTTPCookie.new, + this.newAuthenticationChallengeResponse = + AuthenticationChallengeResponse.new, + this.newWKWebViewConfiguration = WKWebViewConfiguration.new, + this.newWKScriptMessageHandler = WKScriptMessageHandler.new, + this.newWKNavigationDelegate = WKNavigationDelegate.new, + this.newNSObject = NSObject.new, + this.newUIViewWKWebView = UIViewWKWebView.new, + this.newNSViewWKWebView = NSViewWKWebView.new, + this.newWKUIDelegate = WKUIDelegate.new, + this.newUIScrollViewDelegate = UIScrollViewDelegate.new, + this.withUserURLCredential = URLCredential.withUser, + this.createAsyncAuthenticationChallengeResponse = + AuthenticationChallengeResponse.createAsync, + this.withUserAsyncURLCredential = URLCredential.withUserAsync, + this.serverTrustAsyncURLCredential = URLCredential.serverTrustAsync, + this.evaluateWithErrorSecTrust = SecTrust.evaluateWithError, + this.copyExceptionsSecTrust = SecTrust.copyExceptions, + this.setExceptionsSecTrust = SecTrust.setExceptions, + this.getTrustResultSecTrust = SecTrust.getTrustResult, + this.copyCertificateChainSecTrust = SecTrust.copyCertificateChain, + this.copyDataSecCertificate = SecCertificate.copyData, + this.defaultDataStoreWKWebsiteDataStore = + _defaultDataStoreWKWebsiteDataStore, + }); + + /// Constructs [URLRequest]. + final URLRequest Function({ + required String url, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newURLRequest; + + /// Constructs [WKUserScript]. + final WKUserScript Function({ + required String source, + required UserScriptInjectionTime injectionTime, + required bool isForMainFrameOnly, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKUserScript; + + /// Constructs [HTTPCookie]. + final HTTPCookie Function({ + required Map properties, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newHTTPCookie; + + /// Constructs [AuthenticationChallengeResponse]. + final AuthenticationChallengeResponse Function({ + required UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newAuthenticationChallengeResponse; + + /// Constructs [WKWebViewConfiguration]. + final WKWebViewConfiguration Function({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKWebViewConfiguration; + + /// Constructs [WKScriptMessageHandler]. + final WKScriptMessageHandler Function({ + required void Function( + WKScriptMessageHandler, + WKUserContentController, + WKScriptMessage, + ) didReceiveScriptMessage, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKScriptMessageHandler; + + /// Constructs [WKNavigationDelegate]. + final WKNavigationDelegate Function({ + required Future Function( + WKNavigationDelegate, + WKWebView, + WKNavigationAction, + ) decidePolicyForNavigationAction, + required Future Function( + WKNavigationDelegate, + WKWebView, + WKNavigationResponse, + ) decidePolicyForNavigationResponse, + required Future Function( + WKNavigationDelegate, + WKWebView, + URLAuthenticationChallenge, + ) didReceiveAuthenticationChallenge, + void Function( + WKNavigationDelegate, + WKWebView, + String?, + )? didFinishNavigation, + void Function( + WKNavigationDelegate, + WKWebView, + String?, + )? didStartProvisionalNavigation, + void Function( + WKNavigationDelegate, + WKWebView, + NSError, + )? didFailNavigation, + void Function( + WKNavigationDelegate, + WKWebView, + NSError, + )? didFailProvisionalNavigation, + void Function( + WKNavigationDelegate, + WKWebView, + )? webViewWebContentProcessDidTerminate, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKNavigationDelegate; + + /// Constructs [NSObject]. + final NSObject Function({ + void Function( + NSObject, + String?, + NSObject?, + Map?, + )? observeValue, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newNSObject; + + /// Constructs [UIViewWKWebView]. + final UIViewWKWebView Function({ + required WKWebViewConfiguration initialConfiguration, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newUIViewWKWebView; + + /// Constructs [NSViewWKWebView]. + final NSViewWKWebView Function({ + required WKWebViewConfiguration initialConfiguration, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newNSViewWKWebView; + + /// Constructs [WKUIDelegate]. + final WKUIDelegate Function({ + required Future Function( + WKUIDelegate, + WKWebView, + WKSecurityOrigin, + WKFrameInfo, + MediaCaptureType, + ) requestMediaCapturePermission, + required Future Function( + WKUIDelegate, + WKWebView, + String, + WKFrameInfo, + ) runJavaScriptConfirmPanel, + void Function( + WKUIDelegate, + WKWebView, + WKWebViewConfiguration, + WKNavigationAction, + )? onCreateWebView, + Future Function( + WKUIDelegate, + WKWebView, + String, + WKFrameInfo, + )? runJavaScriptAlertPanel, + Future Function( + WKUIDelegate, + WKWebView, + String, + String?, + WKFrameInfo, + )? runJavaScriptTextInputPanel, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newWKUIDelegate; + + /// Constructs [UIScrollViewDelegate]. + final UIScrollViewDelegate Function({ + void Function( + UIScrollViewDelegate, + UIScrollView, + double, + double, + )? scrollViewDidScroll, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) newUIScrollViewDelegate; + + /// Constructs [URLCredential]. + final URLCredential Function({ + required String user, + required String password, + required UrlCredentialPersistence persistence, + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) withUserURLCredential; + + /// Calls to [AuthenticationChallengeResponse.createAsync]. + final Future Function( + UrlSessionAuthChallengeDisposition, + URLCredential?, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) createAsyncAuthenticationChallengeResponse; + + /// Calls to [URLCredential.withUserAsync]. + final Future Function( + String, + String, + UrlCredentialPersistence, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) withUserAsyncURLCredential; + + /// Calls to [URLCredential.serverTrustAsync]. + final Future Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) serverTrustAsyncURLCredential; + + /// Calls to [SecTrust.evaluateWithError]. + final Future Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) evaluateWithErrorSecTrust; + + /// Calls to [SecTrust.copyExceptions]. + final Future Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) copyExceptionsSecTrust; + + /// Calls to [SecTrust.setExceptions]. + final Future Function( + SecTrust, + Uint8List?, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) setExceptionsSecTrust; + + /// Calls to [SecTrust.getTrustResult]. + final Future Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) getTrustResultSecTrust; + + /// Calls to [SecTrust.copyCertificateChain]. + final Future?> Function( + SecTrust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) copyCertificateChainSecTrust; + + /// Calls to [SecCertificate.copyData]. + final Future Function( + SecCertificate, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) copyDataSecCertificate; + + /// Calls to [WKWebsiteDataStore.defaultDataStore]. + final WKWebsiteDataStore Function() defaultDataStoreWKWebsiteDataStore; + + static WKWebsiteDataStore _defaultDataStoreWKWebsiteDataStore() => + WKWebsiteDataStore.defaultDataStore; } + /// The values that can be returned in a change dictionary. /// /// See https://developer.apple.com/documentation/foundation/nskeyvalueobservingoptions. @@ -476,15 +721,12 @@ enum KeyValueObservingOptions { /// Indicates that the change dictionary should provide the new attribute /// value, if applicable. newValue, - /// Indicates that the change dictionary should contain the old attribute /// value, if applicable. oldValue, - /// If specified, a notification should be sent to the observer immediately, /// before the observer registration method even returns. initialValue, - /// Whether separate notifications should be sent to the observer before and /// after each change, instead of a single notification after the change. priorNotification, @@ -496,19 +738,15 @@ enum KeyValueObservingOptions { enum KeyValueChange { /// Indicates that the value of the observed key path was set to a new value. setting, - /// Indicates that an object has been inserted into the to-many relationship /// that is being observed. insertion, - /// Indicates that an object has been removed from the to-many relationship /// that is being observed. removal, - /// Indicates that an object has been replaced in the to-many relationship /// that is being observed. replacement, - /// The value is not recognized by the wrapper. unknown, } @@ -522,28 +760,23 @@ enum KeyValueChangeKey { /// `KeyValueChange.replacement`, the value of this key is a Set object that /// contains the indexes of the inserted, removed, or replaced objects. indexes, - /// An object that contains a value corresponding to one of the /// `KeyValueChange` enum, indicating what sort of change has occurred. kind, - /// If the value of the `KeyValueChange.kind` entry is /// `KeyValueChange.setting, and `KeyValueObservingOptions.newValue` was /// specified when the observer was registered, the value of this key is the /// new value for the attribute. newValue, - /// If the `KeyValueObservingOptions.priorNotification` option was specified /// when the observer was registered this notification is sent prior to a /// change. notificationIsPrior, - /// If the value of the `KeyValueChange.kind` entry is /// `KeyValueChange.setting`, and `KeyValueObservingOptions.old` was specified /// when the observer was registered, the value of this key is the value /// before the attribute was changed. oldValue, - /// The value is not recognized by the wrapper. unknown, } @@ -555,11 +788,9 @@ enum UserScriptInjectionTime { /// A constant to inject the script after the creation of the webpage’s /// document element, but before loading any other content. atDocumentStart, - /// A constant to inject the script after the document finishes loading, but /// before loading any other subresources. atDocumentEnd, - /// The value is not recognized by the wrapper. unknown, } @@ -570,13 +801,10 @@ enum UserScriptInjectionTime { enum AudiovisualMediaType { /// No media types require a user gesture to begin playing. none, - /// Media types that contain audio require a user gesture to begin playing. audio, - /// Media types that contain video require a user gesture to begin playing. video, - /// All media types require a user gesture to begin playing. all, } @@ -588,25 +816,18 @@ enum AudiovisualMediaType { enum WebsiteDataType { /// Cookies. cookies, - /// In-memory caches. memoryCache, - /// On-disk caches. diskCache, - /// HTML offline web app caches. offlineWebApplicationCache, - /// HTML local storage. localStorage, - /// HTML session storage. sessionStorage, - /// WebSQL databases. webSQLDatabases, - /// IndexedDB databases. indexedDBDatabases, } @@ -618,10 +839,8 @@ enum WebsiteDataType { enum NavigationActionPolicy { /// Allow the navigation to continue. allow, - /// Cancel the navigation. cancel, - /// Allow the download to proceed. download, } @@ -633,10 +852,8 @@ enum NavigationActionPolicy { enum NavigationResponsePolicy { /// Allow the navigation to continue. allow, - /// Cancel the navigation. cancel, - /// Allow the download to proceed. download, } @@ -647,51 +864,37 @@ enum NavigationResponsePolicy { enum HttpCookiePropertyKey { /// A String object containing the comment for the cookie. comment, - /// An Uri object or String object containing the comment URL for the cookie. commentUrl, - /// Aa String object stating whether the cookie should be discarded at the end /// of the session. discard, - /// An String object containing the domain for the cookie. domain, - /// An Date object or String object specifying the expiration date for the /// cookie. expires, - /// An String object containing an integer value stating how long in seconds /// the cookie should be kept, at most. maximumAge, - /// An String object containing the name of the cookie (required). name, - /// A URL or String object containing the URL that set this cookie. originUrl, - /// A String object containing the path for the cookie. path, - /// An String object containing comma-separated integer values specifying the /// ports for the cookie. port, - /// A string indicating the same-site policy for the cookie. sameSitePolicy, - /// A String object indicating that the cookie should be transmitted only over /// secure channels. secure, - /// A String object containing the value of the cookie. value, - /// A String object that specifies the version of the cookie. version, - /// The value is not recognized by the wrapper. unknown, } @@ -702,22 +905,16 @@ enum HttpCookiePropertyKey { enum NavigationType { /// A link activation. linkActivated, - /// A request to submit a form. formSubmitted, - /// A request for the frame’s next or previous item. backForward, - /// A request to reload the webpage. reload, - /// A request to resubmit a form. formResubmitted, - /// A navigation request that originates for some other reason. other, - /// The value is not recognized by the wrapper. unknown, } @@ -728,10 +925,8 @@ enum NavigationType { enum PermissionDecision { /// Deny permission for the requested resource. deny, - /// Deny permission for the requested resource. grant, - /// Prompt the user for permission for the requested resource. prompt, } @@ -742,13 +937,10 @@ enum PermissionDecision { enum MediaCaptureType { /// A media device that can capture video. camera, - /// A media device or devices that can capture audio and video. cameraAndMicrophone, - /// A media device that can capture audio. microphone, - /// The value is not recognized by the wrapper. unknown, } @@ -759,18 +951,14 @@ enum MediaCaptureType { enum UrlSessionAuthChallengeDisposition { /// Use the specified credential, which may be nil. useCredential, - /// Use the default handling for the challenge as though this delegate method /// were not implemented. performDefaultHandling, - /// Cancel the entire request. cancelAuthenticationChallenge, - /// Reject this challenge, and call the authentication delegate method again /// with the next authentication protection space. rejectProtectionSpace, - /// The value is not recognized by the wrapper. unknown, } @@ -781,13 +969,10 @@ enum UrlSessionAuthChallengeDisposition { enum UrlCredentialPersistence { /// The credential should not be stored. none, - /// The credential should be stored only for this session. forSession, - /// The credential should be stored in the keychain. permanent, - /// The credential should be stored permanently in the keychain, and in /// addition should be distributed to other devices based on the owning Apple /// ID. @@ -800,33 +985,26 @@ enum UrlCredentialPersistence { enum DartSecTrustResultType { /// The user did not specify a trust setting. unspecified, - /// The user granted permission to trust the certificate for the purposes /// designated in the specified policies. proceed, - /// The user specified that the certificate should not be trusted. deny, - /// Trust is denied, but recovery may be possible. recoverableTrustFailure, - /// Trust is denied and no simple fix is available. fatalTrustFailure, - /// A value that indicates a failure other than trust evaluation. otherError, - /// An indication of an invalid setting or result. invalid, - /// User confirmation is required before proceeding. confirm, - /// The type is not recognized by this wrapper. unknown, } + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -834,49 +1012,49 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is KeyValueObservingOptions) { + } else if (value is KeyValueObservingOptions) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is KeyValueChange) { + } else if (value is KeyValueChange) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is KeyValueChangeKey) { + } else if (value is KeyValueChangeKey) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is UserScriptInjectionTime) { + } else if (value is UserScriptInjectionTime) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is AudiovisualMediaType) { + } else if (value is AudiovisualMediaType) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is WebsiteDataType) { + } else if (value is WebsiteDataType) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is NavigationActionPolicy) { + } else if (value is NavigationActionPolicy) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is NavigationResponsePolicy) { + } else if (value is NavigationResponsePolicy) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is HttpCookiePropertyKey) { + } else if (value is HttpCookiePropertyKey) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is NavigationType) { + } else if (value is NavigationType) { buffer.putUint8(138); writeValue(buffer, value.index); - } else if (value is PermissionDecision) { + } else if (value is PermissionDecision) { buffer.putUint8(139); writeValue(buffer, value.index); - } else if (value is MediaCaptureType) { + } else if (value is MediaCaptureType) { buffer.putUint8(140); writeValue(buffer, value.index); - } else if (value is UrlSessionAuthChallengeDisposition) { + } else if (value is UrlSessionAuthChallengeDisposition) { buffer.putUint8(141); writeValue(buffer, value.index); - } else if (value is UrlCredentialPersistence) { + } else if (value is UrlCredentialPersistence) { buffer.putUint8(142); writeValue(buffer, value.index); - } else if (value is DartSecTrustResultType) { + } else if (value is DartSecTrustResultType) { buffer.putUint8(143); writeValue(buffer, value.index); } else { @@ -887,51 +1065,49 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueObservingOptions.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChange.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChangeKey.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : UserScriptInjectionTime.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : AudiovisualMediaType.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : WebsiteDataType.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationActionPolicy.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationResponsePolicy.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : HttpCookiePropertyKey.values[value]; - case 138: + case 138: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationType.values[value]; - case 139: + case 139: final int? value = readValue(buffer) as int?; return value == null ? null : PermissionDecision.values[value]; - case 140: + case 140: final int? value = readValue(buffer) as int?; return value == null ? null : MediaCaptureType.values[value]; - case 141: + case 141: final int? value = readValue(buffer) as int?; - return value == null - ? null - : UrlSessionAuthChallengeDisposition.values[value]; - case 142: + return value == null ? null : UrlSessionAuthChallengeDisposition.values[value]; + case 142: final int? value = readValue(buffer) as int?; return value == null ? null : UrlCredentialPersistence.values[value]; - case 143: + case 143: final int? value = readValue(buffer) as int?; return value == null ? null : DartSecTrustResultType.values[value]; default: @@ -939,7 +1115,6 @@ class _PigeonCodec extends StandardMessageCodec { } } } - /// A URL load request that is independent of protocol or URL scheme. /// /// See https://developer.apple.com/documentation/foundation/urlrequest. @@ -2462,6 +2637,51 @@ class AuthenticationChallengeResponse extends PigeonInternalProxyApiBaseClass { } } + /// Creates an [AuthenticationChallengeResponse] + /// + /// This provides the native `AuthenticationChallengeResponse()` constructor + /// as an async method to ensure the class is added to the InstanceManager. + /// See https://github.com/flutter/flutter/issues/162437. + static Future createAsync( + UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInstanceManager.instance); + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.createAsync'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([disposition, credential]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture 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 AuthenticationChallengeResponse?)!; + } + } + @override AuthenticationChallengeResponse pigeon_copy() { return AuthenticationChallengeResponse.pigeon_detached( @@ -4369,16 +4589,6 @@ class WKNavigationDelegate extends NSObject { /// Asks the delegate to respond to an authentication challenge. /// - /// This return value expects a List with: - /// - /// 1. `UrlSessionAuthChallengeDisposition` - /// 2. A nullable map to instantiate a `URLCredential`. The map structure is - /// [ - /// "user": "", - /// "password": "", - /// "persistence": , - /// ] - /// /// For the associated Native object to be automatically garbage collected, /// it is required that the implementation of this `Function` doesn't have a /// strong reference to the encapsulating class instance. When this `Function` @@ -4396,7 +4606,7 @@ class WKNavigationDelegate extends NSObject { /// /// Alternatively, [PigeonInstanceManager.removeWeakReference] can be used to /// release the associated Native object manually. - final Future> Function( + final Future Function( WKNavigationDelegate pigeon_instance, WKWebView webView, URLAuthenticationChallenge challenge, @@ -4440,7 +4650,7 @@ class WKNavigationDelegate extends NSObject { WKNavigationDelegate pigeon_instance, WKWebView webView, )? webViewWebContentProcessDidTerminate, - Future> Function( + Future Function( WKNavigationDelegate pigeon_instance, WKWebView webView, URLAuthenticationChallenge challenge, @@ -4746,7 +4956,7 @@ 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 List output = + final AuthenticationChallengeResponse output = await (didReceiveAuthenticationChallenge ?? arg_pigeon_instance!.didReceiveAuthenticationChallenge) .call(arg_pigeon_instance!, arg_webView!, arg_challenge!); @@ -7617,6 +7827,98 @@ class URLCredential extends NSObject { } } + /// Creates a URL credential instance for internet password authentication + /// with a given user name and password, using a given persistence setting. + /// + /// This provides the native `UrlCredential(user:password:persistence)` + /// constructor as an async method to ensure the class is added to the + /// InstanceManager. See https://github.com/flutter/flutter/issues/162437. + static Future withUserAsync( + String user, + String password, + UrlCredentialPersistence persistence, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInstanceManager.instance); + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUserAsync'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([user, password, persistence]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture 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 URLCredential?)!; + } + } + + /// Creates a URL credential instance for server trust authentication, + /// initialized with a accepted trust. + /// + /// This provides the native `UrlCredential(forTrust:)` constructor as an + /// async method to ensure the class is added to the InstanceManager. See + /// https://github.com/flutter/flutter/issues/162437. + static Future serverTrustAsync( + SecTrust trust, { + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + }) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _PigeonInternalProxyApiBaseCodec( + pigeon_instanceManager ?? PigeonInstanceManager.instance); + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const String pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.serverTrustAsync'; + final BasicMessageChannel pigeonVar_channel = + BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = + pigeonVar_channel.send([trust]); + final List? pigeonVar_replyList = + await pigeonVar_sendFuture 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 URLCredential?)!; + } + } + @override URLCredential pigeon_copy() { return URLCredential.pigeon_detached( @@ -8595,3 +8897,4 @@ class SecCertificate extends NSObject { ); } } + 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 89e184a89a5a..5eef2a3d52bb 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 @@ -193,10 +193,10 @@ class WebKitWebViewPlatformController extends WebViewPlatformController { return NavigationResponsePolicy.allow; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + ); }, ); }, @@ -751,7 +751,7 @@ class WebViewWidgetProxy { WKWebView webView, WKNavigationResponse navigationResponse, ) decidePolicyForNavigationResponse, - required Future> Function( + required Future Function( WKNavigationDelegate, WKWebView webView, URLAuthenticationChallenge challenge, 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 f4a570a34217..f0736d741eed 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 @@ -31,6 +31,10 @@ class WebKitProxy { this.newPlatformWebView = PlatformWebView.new, this.newWKUIDelegate = WKUIDelegate.new, this.newUIScrollViewDelegate = UIScrollViewDelegate.new, + this.createAsyncAuthenticationChallengeResponse = + AuthenticationChallengeResponse.createAsync, + this.withUserAsyncURLCredential = URLCredential.withUserAsync, + this.serverTrustAsyncURLCredential = URLCredential.serverTrustAsync, this.withUserURLCredential = URLCredential.withUser, this.evaluateWithErrorSecTrust = SecTrust.evaluateWithError, this.copyExceptionsSecTrust = SecTrust.copyExceptions, @@ -110,7 +114,7 @@ class WebKitProxy { WKNavigationDelegate, WKWebView, )? webViewWebContentProcessDidTerminate, - required Future> Function( + required Future Function( WKNavigationDelegate, WKWebView, URLAuthenticationChallenge, @@ -183,6 +187,22 @@ class WebKitProxy { )? scrollViewDidScroll, }) newUIScrollViewDelegate; + /// Calls to [AuthenticationChallengeResponse.createAsync]. + final Future Function( + UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + ) createAsyncAuthenticationChallengeResponse; + + /// Calls to [URLCredential.withUserAsync]. + final Future Function( + String, + String, + UrlCredentialPersistence, + ) withUserAsyncURLCredential; + + /// Calls to [URLCredential.serverTrustAsync]. + final Future Function(SecTrust) serverTrustAsyncURLCredential; + /// Constructs [URLCredential]. final URLCredential Function({ required String user, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart index b694b03de6e3..db857d67f9b9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_ssl_auth_error.dart @@ -19,9 +19,9 @@ class WebKitSslAuthError extends PlatformSslAuthError { required this.host, required this.port, required WebKitProxy proxy, - required void Function( + required Future Function( UrlSessionAuthChallengeDisposition disposition, - Map? credentialMap, + URLCredential? credential, ) onResponse, }) : _trust = trust, _proxy = proxy, @@ -30,9 +30,9 @@ class WebKitSslAuthError extends PlatformSslAuthError { final SecTrust _trust; final WebKitProxy _proxy; - final void Function( + final Future Function( UrlSessionAuthChallengeDisposition disposition, - Map? credentialMap, + URLCredential? credential, ) _onResponse; /// The host portion of the url associated with the error. @@ -43,7 +43,7 @@ class WebKitSslAuthError extends PlatformSslAuthError { @override Future cancel() async { - _onResponse( + await _onResponse( UrlSessionAuthChallengeDisposition.cancelAuthenticationChallenge, null, ); @@ -55,9 +55,10 @@ class WebKitSslAuthError extends PlatformSslAuthError { if (exceptions != null) { await _proxy.setExceptionsSecTrust(_trust, exceptions); } - _onResponse( + + await _onResponse( UrlSessionAuthChallengeDisposition.useCredential, - {'serverTrust': _trust}, + await _proxy.serverTrustAsyncURLCredential(_trust), ); } } 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 88ab3b6ec9d1..1a0aa3ea4a4b 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 @@ -1242,8 +1242,8 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { final WebKitProxy proxy = (delegate.params as WebKitNavigationDelegateCreationParams) .webKitProxy; - final Completer> responseCompleter = - Completer>(); + final Completer responseCompleter = + Completer(); switch (protectionSpace.authenticationMethod) { case NSUrlAuthenticationMethod.httpBasic: @@ -1255,25 +1255,25 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { HttpAuthRequest( host: protectionSpace.host, realm: protectionSpace.realm, - onProceed: (WebViewCredential credential) { + onProceed: (WebViewCredential credential) async { responseCompleter.complete( - [ + await AuthenticationChallengeResponse.createAsync( UrlSessionAuthChallengeDisposition.useCredential, - { - 'user': credential.user, - 'password': credential.password, - 'persistence': UrlCredentialPersistence.forSession, - }, - ], + await URLCredential.withUserAsync( + credential.user, + credential.password, + UrlCredentialPersistence.forSession, + ), + ), ); }, - onCancel: () { + onCancel: () async { responseCompleter.complete( - [ + await AuthenticationChallengeResponse.createAsync( UrlSessionAuthChallengeDisposition .cancelAuthenticationChallenge, null, - ], + ), ); }, ), @@ -1328,10 +1328,13 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { proxy: proxy, onResponse: ( UrlSessionAuthChallengeDisposition disposition, - Map? credentialMap, - ) { + URLCredential? credential, + ) async { responseCompleter.complete( - [disposition, credentialMap], + await AuthenticationChallengeResponse.createAsync( + disposition, + credential, + ), ); }, ), @@ -1343,10 +1346,10 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { } } - return [ + return AuthenticationChallengeResponse.createAsync( UrlSessionAuthChallengeDisposition.performDefaultHandling, null, - ]; + ); }, ); } 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 8f567b9335dd..8f73a7f68342 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -549,6 +549,18 @@ abstract class HTTPCookie extends NSObject { abstract class AuthenticationChallengeResponse { AuthenticationChallengeResponse(); + /// Creates an [AuthenticationChallengeResponse] + /// + /// This provides the native `AuthenticationChallengeResponse()` constructor + /// as an async method to ensure the class is added to the InstanceManager. + /// See https://github.com/flutter/flutter/issues/162437. + @async + @static + AuthenticationChallengeResponse createAsync( + UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + ); + /// The option to use to handle the challenge. late UrlSessionAuthChallengeDisposition disposition; @@ -778,22 +790,9 @@ abstract class WKNavigationDelegate extends NSObject { /// Tells the delegate that the web view’s content process was terminated. void Function(WKWebView webView)? webViewWebContentProcessDidTerminate; - // TODO(bparrishMines): This method should return an - // `AuthenticationChallengeResponse` once the cause of - // https://github.com/flutter/flutter/issues/162437 can be found and fixed. /// Asks the delegate to respond to an authentication challenge. - /// - /// This return value expects a List with: - /// - /// 1. `UrlSessionAuthChallengeDisposition` - /// 2. A nullable map to instantiate a `URLCredential`. The map structure is - /// [ - /// "user": "", - /// "password": "", - /// "persistence": , - /// ] @async - late List Function( + late AuthenticationChallengeResponse Function( WKWebView webView, URLAuthenticationChallenge challenge, ) didReceiveAuthenticationChallenge; @@ -1121,6 +1120,30 @@ abstract class URLCredential extends NSObject { String password, UrlCredentialPersistence persistence, ); + + /// Creates a URL credential instance for internet password authentication + /// with a given user name and password, using a given persistence setting. + /// + /// This provides the native `UrlCredential(user:password:persistence)` + /// constructor as an async method to ensure the class is added to the + /// InstanceManager. See https://github.com/flutter/flutter/issues/162437. + @async + @static + URLCredential withUserAsync( + String user, + String password, + UrlCredentialPersistence persistence, + ); + + /// Creates a URL credential instance for server trust authentication, + /// initialized with a accepted trust. + /// + /// This provides the native `UrlCredential(forTrust:)` constructor as an + /// async method to ensure the class is added to the InstanceManager. See + /// https://github.com/flutter/flutter/issues/162437. + @async + @static + URLCredential serverTrustAsync(SecTrust trust); } /// A server or an area on a server, commonly referred to as a realm, that diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 9cfd5751c6cc..a33942e65fab 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -33,7 +33,11 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^25.3.1 + pigeon: + git: + url: git@github.com:bparrishMines/packages.git + ref: pigeon_helper + path: packages/pigeon topics: - html From fa0aa282dcd2b75bb0087acfd6e4ff62dd8ae540 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:27:18 -0400 Subject: [PATCH 28/34] update dart unit tests --- .../lib/src/webkit_webview_controller.dart | 9 +- .../pigeons/web_kit.dart | 4 + .../web_kit_cookie_manager_test.mocks.dart | 119 +- .../web_kit_webview_widget_test.mocks.dart | 1227 +++++++++++++---- .../test/webkit_navigation_delegate_test.dart | 216 +-- ...webkit_navigation_delegate_test.mocks.dart | 262 +++- .../test/webkit_webview_controller_test.dart | 8 +- .../webkit_webview_controller_test.mocks.dart | 1125 +++++++++++---- ...kit_webview_cookie_manager_test.mocks.dart | 119 +- .../webkit_webview_widget_test.mocks.dart | 274 +++- 10 files changed, 2566 insertions(+), 797 deletions(-) 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 1a0aa3ea4a4b..aad23ade17dd 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 @@ -1257,9 +1257,9 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { realm: protectionSpace.realm, onProceed: (WebViewCredential credential) async { responseCompleter.complete( - await AuthenticationChallengeResponse.createAsync( + await proxy.createAsyncAuthenticationChallengeResponse( UrlSessionAuthChallengeDisposition.useCredential, - await URLCredential.withUserAsync( + await proxy.withUserAsyncURLCredential( credential.user, credential.password, UrlCredentialPersistence.forSession, @@ -1269,7 +1269,7 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { }, onCancel: () async { responseCompleter.complete( - await AuthenticationChallengeResponse.createAsync( + await proxy.createAsyncAuthenticationChallengeResponse( UrlSessionAuthChallengeDisposition .cancelAuthenticationChallenge, null, @@ -1331,7 +1331,8 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { URLCredential? credential, ) async { responseCompleter.complete( - await AuthenticationChallengeResponse.createAsync( + await proxy + .createAsyncAuthenticationChallengeResponse( disposition, credential, ), 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 8f73a7f68342..3d181d704bc3 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart @@ -547,6 +547,10 @@ abstract class HTTPCookie extends NSObject { /// values. The wrapper returns this class instead to handle this scenario. @ProxyApi() abstract class AuthenticationChallengeResponse { + /// Creates an [AuthenticationChallengeResponse]. + /// + /// Due to https://github.com/flutter/flutter/issues/162437, this should only + /// be used for testing. AuthenticationChallengeResponse(); /// Creates an [AuthenticationChallengeResponse] 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 4e7d186e80f5..1cc0655d88dc 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.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_wkwebview/test/legacy/web_kit_cookie_manager_test.dart. // Do not manually edit this file. @@ -24,20 +24,35 @@ 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]. @@ -59,17 +74,26 @@ 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); @@ -80,15 +104,31 @@ 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); @@ -123,10 +163,16 @@ 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); @@ -136,19 +182,28 @@ 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); @@ -159,15 +214,31 @@ 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.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.mocks.dart index 88df3f478fc5..6faf240e477c 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.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_wkwebview/test/legacy/web_kit_webview_widget_test.dart. // Do not manually edit this file. @@ -35,87 +35,173 @@ 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(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeURLRequest_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeWKNavigationDelegate_3 extends _i1.SmartFake +class _FakeAuthenticationChallengeResponse_3 extends _i1.SmartFake + implements _i2.AuthenticationChallengeResponse { + _FakeAuthenticationChallengeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); +} + +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_11 extends _i1.SmartFake +class _FakeWKWebpagePreferences_12 extends _i1.SmartFake implements _i2.WKWebpagePreferences { - _FakeWKWebpagePreferences_11(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWKWebpagePreferences_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeWKHTTPCookieStore_12 extends _i1.SmartFake +class _FakeWKHTTPCookieStore_13 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { - _FakeWKHTTPCookieStore_12(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWKHTTPCookieStore_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } -class _FakeWKUIDelegate_13 extends _i1.SmartFake implements _i2.WKUIDelegate { - _FakeWKUIDelegate_13(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_14 extends _i1.SmartFake +class _FakePlatformWebView_15 extends _i1.SmartFake implements _i3.PlatformWebView { - _FakePlatformWebView_14(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakePlatformWebView_15( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [UIScrollView]. @@ -137,21 +223,43 @@ 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); @@ -159,35 +267,50 @@ 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]), + 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]), + 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]), + 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]), + Invocation.method( + #setAlwaysBounceVertical, + [value], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @@ -195,30 +318,45 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @override _i4.Future setAlwaysBounceHorizontal(bool? value) => (super.noSuchMethod( - Invocation.method(#setAlwaysBounceHorizontal, [value]), + 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); @@ -230,15 +368,31 @@ 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); @@ -263,40 +417,58 @@ 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); @@ -304,16 +476,25 @@ 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); @@ -324,15 +505,31 @@ 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); @@ -360,8 +557,7 @@ class MockWKNavigationDelegate extends _i1.Mock _i2.WKNavigationAction navigationAction, ) => _i4.Future<_i2.NavigationActionPolicy>.value( - _i2.NavigationActionPolicy.allow, - ), + _i2.NavigationActionPolicy.allow), ) as _i4.Future<_i2.NavigationActionPolicy> Function( _i2.WKNavigationDelegate, _i2.WKWebView, @@ -381,8 +577,7 @@ class MockWKNavigationDelegate extends _i1.Mock _i2.WKNavigationResponse navigationResponse, ) => _i4.Future<_i2.NavigationResponsePolicy>.value( - _i2.NavigationResponsePolicy.allow, - ), + _i2.NavigationResponsePolicy.allow), ) as _i4.Future<_i2.NavigationResponsePolicy> Function( _i2.WKNavigationDelegate, _i2.WKWebView, @@ -390,7 +585,7 @@ class MockWKNavigationDelegate extends _i1.Mock )); @override - _i4.Future> Function( + _i4.Future<_i2.AuthenticationChallengeResponse> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.URLAuthenticationChallenge, @@ -401,8 +596,12 @@ class MockWKNavigationDelegate extends _i1.Mock _i2.WKWebView webView, _i2.URLAuthenticationChallenge challenge, ) => - _i4.Future>.value([]), - ) as _i4.Future> Function( + _i4.Future<_i2.AuthenticationChallengeResponse>.value( + _FakeAuthenticationChallengeResponse_3( + this, + Invocation.getter(#didReceiveAuthenticationChallenge), + )), + ) as _i4.Future<_i2.AuthenticationChallengeResponse> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.URLAuthenticationChallenge, @@ -419,10 +618,16 @@ 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); @@ -433,15 +638,31 @@ 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); @@ -466,17 +687,26 @@ 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); @@ -487,15 +717,31 @@ 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); @@ -539,10 +785,16 @@ 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); @@ -553,15 +805,31 @@ 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); @@ -586,10 +854,16 @@ 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); @@ -600,15 +874,31 @@ 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); @@ -625,7 +915,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), ), @@ -651,26 +941,41 @@ 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); @@ -678,103 +983,160 @@ 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); @@ -782,49 +1144,73 @@ 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 _i4.Future setAllowsLinkPreview(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsLinkPreview, [allow]), + Invocation.method( + #setAllowsLinkPreview, + [allow], + ), returnValue: _i4.Future.value(), returnValueForMissingStub: _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); @@ -836,15 +1222,31 @@ 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); @@ -870,10 +1272,12 @@ 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); @@ -881,19 +1285,27 @@ 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); @@ -901,38 +1313,53 @@ 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); @@ -940,19 +1367,22 @@ 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); @@ -960,21 +1390,32 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i4.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( - Invocation.method(#getDefaultWebpagePreferences, []), + Invocation.method( + #getDefaultWebpagePreferences, + [], + ), returnValue: _i4.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, - Invocation.method(#getDefaultWebpagePreferences, []), + _FakeWKWebpagePreferences_12( + this, + Invocation.method( + #getDefaultWebpagePreferences, + [], ), - ), + )), ) as _i4.Future<_i2.WKWebpagePreferences>); @override _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKWebViewConfiguration_7( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeWKWebViewConfiguration_8( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WKWebViewConfiguration); @@ -985,15 +1426,31 @@ 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); @@ -1011,7 +1468,7 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore get httpCookieStore => (super.noSuchMethod( Invocation.getter(#httpCookieStore), - returnValue: _FakeWKHTTPCookieStore_12( + returnValue: _FakeWKHTTPCookieStore_13( this, Invocation.getter(#httpCookieStore), ), @@ -1028,10 +1485,16 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), - returnValue: _FakeWKHTTPCookieStore_12( + Invocation.method( + #pigeonVar_httpCookieStore, + [], + ), + returnValue: _FakeWKHTTPCookieStore_13( this, - Invocation.method(#pigeonVar_httpCookieStore, []), + Invocation.method( + #pigeonVar_httpCookieStore, + [], + ), ), ) as _i2.WKHTTPCookieStore); @@ -1041,19 +1504,28 @@ 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); @@ -1064,15 +1536,31 @@ 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); @@ -1103,8 +1591,7 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { _i2.MediaCaptureType type, ) => _i4.Future<_i2.PermissionDecision>.value( - _i2.PermissionDecision.deny, - ), + _i2.PermissionDecision.deny), ) as _i4.Future<_i2.PermissionDecision> Function( _i2.WKUIDelegate, _i2.WKWebView, @@ -1146,10 +1633,16 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { @override _i2.WKUIDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), - returnValue: _FakeWKUIDelegate_13( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeWKUIDelegate_14( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WKUIDelegate); @@ -1160,15 +1653,31 @@ 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); @@ -1198,7 +1707,13 @@ 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); @@ -1206,14 +1721,20 @@ 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); @@ -1221,24 +1742,36 @@ 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); @@ -1249,15 +1782,31 @@ 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); @@ -1279,16 +1828,28 @@ 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, ); } @@ -1308,34 +1869,50 @@ 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, ); } @@ -1352,8 +1929,11 @@ 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( @@ -1361,7 +1941,7 @@ class MockWebViewWidgetProxy extends _i1.Mock [configuration], {#observeValue: observeValue}, ), - returnValue: _FakePlatformWebView_14( + returnValue: _FakePlatformWebView_15( this, Invocation.method( #createWebView, @@ -1373,97 +1953,115 @@ 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_13( + 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, _i2.WKNavigationResponse, )? decidePolicyForNavigationResponse, - required _i4.Future> Function( + required _i4.Future<_i2.AuthenticationChallengeResponse> Function( _i2.WKNavigationDelegate, _i2.WKWebView, _i2.URLAuthenticationChallenge, )? didReceiveAuthenticationChallenge, }) => (super.noSuchMethod( - Invocation.method(#createNavigationDelegate, [], { - #didFinishNavigation: didFinishNavigation, - #didStartProvisionalNavigation: didStartProvisionalNavigation, - #decidePolicyForNavigationAction: decidePolicyForNavigationAction, - #didFailNavigation: didFailNavigation, - #didFailProvisionalNavigation: didFailProvisionalNavigation, - #webViewWebContentProcessDidTerminate: - webViewWebContentProcessDidTerminate, - #decidePolicyForNavigationResponse: decidePolicyForNavigationResponse, - #didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, - }), - returnValue: _FakeWKNavigationDelegate_3( - this, - Invocation.method(#createNavigationDelegate, [], { + Invocation.method( + #createNavigationDelegate, + [], + { #didFinishNavigation: didFinishNavigation, #didStartProvisionalNavigation: didStartProvisionalNavigation, #decidePolicyForNavigationAction: decidePolicyForNavigationAction, @@ -1475,7 +2073,27 @@ class MockWebViewWidgetProxy extends _i1.Mock decidePolicyForNavigationResponse, #didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, - }), + }, + ), + returnValue: _FakeWKNavigationDelegate_4( + this, + Invocation.method( + #createNavigationDelegate, + [], + { + #didFinishNavigation: didFinishNavigation, + #didStartProvisionalNavigation: didStartProvisionalNavigation, + #decidePolicyForNavigationAction: decidePolicyForNavigationAction, + #didFailNavigation: didFailNavigation, + #didFailProvisionalNavigation: didFailProvisionalNavigation, + #webViewWebContentProcessDidTerminate: + webViewWebContentProcessDidTerminate, + #decidePolicyForNavigationResponse: + decidePolicyForNavigationResponse, + #didReceiveAuthenticationChallenge: + didReceiveAuthenticationChallenge, + }, + ), ), ) as _i2.WKNavigationDelegate); } @@ -1501,17 +2119,26 @@ class MockWKWebpagePreferences extends _i1.Mock @override _i4.Future setAllowsContentJavaScript(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsContentJavaScript, [allow]), + 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_11( + Invocation.method( + #pigeon_copy, + [], + ), + returnValue: _FakeWKWebpagePreferences_12( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WKWebpagePreferences); @@ -1522,15 +2149,31 @@ class MockWKWebpagePreferences 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); 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 56cb91b266f5..c25134f50645 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 @@ -60,10 +60,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -98,10 +99,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -140,10 +142,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -189,10 +192,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -237,10 +241,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -292,10 +297,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -348,10 +354,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -405,10 +412,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -439,13 +447,13 @@ void main() { WebKitNavigationDelegateCreationParams( webKitProxy: WebKitProxy( newWKNavigationDelegate: CapturingNavigationDelegate.new, - newAuthenticationChallengeResponse: ({ - required UrlSessionAuthChallengeDisposition disposition, + createAsyncAuthenticationChallengeResponse: ( + UrlSessionAuthChallengeDisposition disposition, URLCredential? credential, - }) { + ) async { return AuthenticationChallengeResponse.pigeon_detached( - disposition: UrlSessionAuthChallengeDisposition - .cancelAuthenticationChallenge, + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, pigeon_instanceManager: TestInstanceManager(), ); }, @@ -494,10 +502,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -511,36 +520,53 @@ void main() { }); test('onHttpNtlmAuthRequest emits host and realm', () async { + const String expectedUser = 'user'; + const String expectedPassword = 'password'; + const UrlCredentialPersistence expectedPersistence = + UrlCredentialPersistence.forSession; + final WebKitNavigationDelegate iosNavigationDelegate = WebKitNavigationDelegate( WebKitNavigationDelegateCreationParams( webKitProxy: WebKitProxy( - newWKNavigationDelegate: CapturingNavigationDelegate.new, - newAuthenticationChallengeResponse: ({ - required UrlSessionAuthChallengeDisposition disposition, - URLCredential? credential, - }) { - return AuthenticationChallengeResponse.pigeon_detached( - disposition: UrlSessionAuthChallengeDisposition - .cancelAuthenticationChallenge, - pigeon_instanceManager: TestInstanceManager(), - ); - }, - ), + newWKNavigationDelegate: CapturingNavigationDelegate.new, + createAsyncAuthenticationChallengeResponse: ( + UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + ) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: disposition, + credential: credential, + pigeon_instanceManager: TestInstanceManager(), + ); + }, + withUserAsyncURLCredential: ( + String user, + String password, + UrlCredentialPersistence persistence, + ) async { + expect(user, expectedUser); + expect(password, expectedPassword); + expect(persistence, expectedPersistence); + return URLCredential.pigeon_detached( + pigeon_instanceManager: TestInstanceManager(), + ); + }), ), ); String? callbackHost; String? callbackRealm; - const String user = 'user'; - const String password = 'password'; await iosNavigationDelegate.setOnHttpAuthRequest( (HttpAuthRequest request) { callbackHost = request.host; callbackRealm = request.realm; request.onProceed( - const WebViewCredential(user: user, password: password), + const WebViewCredential( + user: expectedUser, + password: expectedPassword, + ), ); }, ); @@ -550,7 +576,7 @@ void main() { final MockURLAuthenticationChallenge mockChallenge = MockURLAuthenticationChallenge(); - when(mockChallenge.getProtectionSpace()).thenAnswer( + when(mockChallenge.getProtectionSpace()).thenAnswer(expectAsync1( (_) { return Future.value( URLProtectionSpace.pigeon_detached( @@ -562,11 +588,11 @@ void main() { ), ); }, - ); + )); - final List result = await CapturingNavigationDelegate - .lastCreatedDelegate - .didReceiveAuthenticationChallenge( + final AuthenticationChallengeResponse result = + await CapturingNavigationDelegate.lastCreatedDelegate + .didReceiveAuthenticationChallenge( WKNavigationDelegate.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), decidePolicyForNavigationAction: (_, __, ___) async { @@ -576,10 +602,11 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ), WKWebView.pigeon_detached( @@ -588,12 +615,9 @@ void main() { mockChallenge, ); - expect(result[0], UrlSessionAuthChallengeDisposition.useCredential); - expect(result[1], containsPair('user', user)); - expect(result[1], containsPair('password', password)); expect( - result[1], - containsPair('persistence', UrlCredentialPersistence.forSession), + result.disposition, + UrlSessionAuthChallengeDisposition.useCredential, ); expect(callbackHost, expectedHost); @@ -614,6 +638,21 @@ void main() { WebKitNavigationDelegateCreationParams( webKitProxy: WebKitProxy( newWKNavigationDelegate: CapturingNavigationDelegate.new, + createAsyncAuthenticationChallengeResponse: ( + UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + ) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: disposition, + credential: credential, + pigeon_instanceManager: TestInstanceManager(), + ); + }, + serverTrustAsyncURLCredential: (_) async { + return URLCredential.pigeon_detached( + pigeon_instanceManager: TestInstanceManager(), + ); + }, evaluateWithErrorSecTrust: (_) async { throw PlatformException( code: exceptionCode, @@ -684,19 +723,20 @@ void main() { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: + UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ); final WKWebView testWebView = WKWebView.pigeon_detached( pigeon_instanceManager: TestInstanceManager(), ); - Future> authReplyFuture = CapturingNavigationDelegate - .lastCreatedDelegate - .didReceiveAuthenticationChallenge( + Future authReplyFuture = + CapturingNavigationDelegate.lastCreatedDelegate + .didReceiveAuthenticationChallenge( testDelegate, testWebView, mockChallenge, @@ -712,11 +752,11 @@ void main() { // Test proceed. await error.proceed(); - List authReply = await authReplyFuture; - expect(authReply, [ + AuthenticationChallengeResponse authReply = await authReplyFuture; + expect( + authReply.disposition, UrlSessionAuthChallengeDisposition.useCredential, - {'serverTrust': testTrust}, - ]); + ); // Test cancel. errorCompleter = Completer(); @@ -731,10 +771,10 @@ void main() { await error.cancel(); authReply = await authReplyFuture; - expect(authReply, [ + expect( + authReply.disposition, UrlSessionAuthChallengeDisposition.cancelAuthenticationChallenge, - null, - ]); + ); }); }); } @@ -762,10 +802,10 @@ class CapturingNavigationDelegate extends WKNavigationDelegate { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ); } 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 214352e8ebf1..b2339f363f67 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.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_wkwebview/test/webkit_navigation_delegate_test.dart. // Do not manually edit this file. @@ -26,30 +26,55 @@ 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]. @@ -73,21 +98,32 @@ 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); @@ -98,15 +134,31 @@ 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); @@ -124,12 +176,17 @@ class MockURLProtectionSpace extends _i1.Mock @override String get host => (super.noSuchMethod( Invocation.getter(#host), - returnValue: _i4.dummyValue(this, Invocation.getter(#host)), + returnValue: _i4.dummyValue( + this, + Invocation.getter(#host), + ), ) as String); @override - int get port => - (super.noSuchMethod(Invocation.getter(#port), returnValue: 0) as int); + int get port => (super.noSuchMethod( + Invocation.getter(#port), + returnValue: 0, + ) as int); @override _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( @@ -142,16 +199,25 @@ class MockURLProtectionSpace extends _i1.Mock @override _i3.Future<_i2.SecTrust?> getServerTrust() => (super.noSuchMethod( - Invocation.method(#getServerTrust, []), + Invocation.method( + #getServerTrust, + [], + ), returnValue: _i3.Future<_i2.SecTrust?>.value(), ) as _i3.Future<_i2.SecTrust?>); @override _i2.URLProtectionSpace pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeURLProtectionSpace_1( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.URLProtectionSpace); @@ -162,15 +228,31 @@ class MockURLProtectionSpace 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); @@ -195,40 +277,58 @@ 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(_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(), ) as _i3.Future<_i5.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); @@ -236,16 +336,25 @@ 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); @@ -256,15 +365,31 @@ 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); @@ -289,19 +414,32 @@ 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, + [], + ), + )), ) 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 @@ -311,15 +449,31 @@ 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 c31ee0f790f2..342c18bfcc3c 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 @@ -1923,10 +1923,10 @@ class CapturingNavigationDelegate extends WKNavigationDelegate { return NavigationResponsePolicy.cancel; }, didReceiveAuthenticationChallenge: (_, __, ___) async { - return [ - UrlSessionAuthChallengeDisposition.performDefaultHandling, - null, - ]; + return AuthenticationChallengeResponse.pigeon_detached( + disposition: UrlSessionAuthChallengeDisposition.performDefaultHandling, + pigeon_instanceManager: TestInstanceManager(), + ); }, ); } 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 3bbeec9f6c3a..d1788f4bc49c 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.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_wkwebview/test/webkit_webview_controller_test.dart. // Do not manually edit this file. @@ -26,86 +26,161 @@ 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 _FakeWKWebpagePreferences_11 extends _i1.SmartFake implements _i2.WKWebpagePreferences { - _FakeWKWebpagePreferences_11(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWKWebpagePreferences_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWKWebViewConfiguration_12 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { - _FakeWKWebViewConfiguration_12(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWKWebViewConfiguration_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUIViewWKWebView_13 extends _i1.SmartFake implements _i2.UIViewWKWebView { - _FakeUIViewWKWebView_13(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeUIViewWKWebView_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWKHTTPCookieStore_14 extends _i1.SmartFake implements _i2.WKHTTPCookieStore { - _FakeWKHTTPCookieStore_14(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWKHTTPCookieStore_14( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [UIScrollView]. @@ -127,24 +202,44 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @override _i3.Future> getContentOffset() => (super.noSuchMethod( - Invocation.method(#getContentOffset, []), - returnValue: _i3.Future>.value([]), - returnValueForMissingStub: _i3.Future>.value( - [], + Invocation.method( + #getContentOffset, + [], ), + returnValue: _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); @@ -152,35 +247,50 @@ 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]), + 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]), + 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]), + 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]), + Invocation.method( + #setAlwaysBounceVertical, + [value], + ), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @@ -188,34 +298,52 @@ class MockUIScrollView extends _i1.Mock implements _i2.UIScrollView { @override _i3.Future setAlwaysBounceHorizontal(bool? value) => (super.noSuchMethod( - Invocation.method(#setAlwaysBounceHorizontal, [value]), + 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); @@ -227,15 +355,31 @@ 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); @@ -261,14 +405,23 @@ 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); @@ -279,15 +432,31 @@ 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); @@ -312,28 +481,46 @@ 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, + [], ), - returnValueForMissingStub: _i3.Future.value( - _i4.dummyValue( - this, - Invocation.method(#getAbsoluteString, []), + returnValue: _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); @@ -344,15 +531,31 @@ 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); @@ -377,35 +580,50 @@ 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?>); @@ -413,7 +631,10 @@ 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); @@ -421,21 +642,33 @@ 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); @@ -446,15 +679,31 @@ 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); @@ -479,21 +728,33 @@ 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); @@ -504,15 +765,31 @@ 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); @@ -561,14 +838,23 @@ 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); @@ -579,15 +865,31 @@ 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); @@ -617,7 +919,13 @@ 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); @@ -625,14 +933,20 @@ 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); @@ -640,28 +954,43 @@ 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); @@ -672,15 +1001,31 @@ 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); @@ -732,14 +1077,23 @@ 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); @@ -750,15 +1104,31 @@ 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); @@ -783,14 +1153,23 @@ 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); @@ -801,15 +1180,31 @@ 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); @@ -835,10 +1230,12 @@ 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); @@ -846,26 +1243,36 @@ 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); @@ -873,50 +1280,69 @@ 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, + [], ), - returnValueForMissingStub: _i3.Future<_i2.WKWebsiteDataStore>.value( - _FakeWKWebsiteDataStore_10( - this, - 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, + [], + ), + )), ) 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, + [], ), - returnValueForMissingStub: _i3.Future<_i2.WKPreferences>.value( - _FakeWKPreferences_5( - this, - 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, + [], + ), + )), ) 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); @@ -924,19 +1350,22 @@ 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); @@ -944,31 +1373,47 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( - Invocation.method(#getDefaultWebpagePreferences, []), + Invocation.method( + #getDefaultWebpagePreferences, + [], + ), returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, - Invocation.method(#getDefaultWebpagePreferences, []), + _FakeWKWebpagePreferences_11( + this, + Invocation.method( + #getDefaultWebpagePreferences, + [], ), - ), + )), returnValueForMissingStub: _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_11( - this, - Invocation.method(#getDefaultWebpagePreferences, []), + _FakeWKWebpagePreferences_11( + this, + Invocation.method( + #getDefaultWebpagePreferences, + [], ), - ), + )), ) as _i3.Future<_i2.WKWebpagePreferences>); @override _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWKWebViewConfiguration_12( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), returnValueForMissingStub: _FakeWKWebViewConfiguration_12( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WKWebViewConfiguration); @@ -979,15 +1424,31 @@ 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); @@ -1014,21 +1475,33 @@ class MockWKWebpagePreferences extends _i1.Mock @override _i3.Future setAllowsContentJavaScript(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsContentJavaScript, [allow]), + Invocation.method( + #setAllowsContentJavaScript, + [allow], + ), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.WKWebpagePreferences pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWKWebpagePreferences_11( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), returnValueForMissingStub: _FakeWKWebpagePreferences_11( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WKWebpagePreferences); @@ -1039,15 +1512,31 @@ class MockWKWebpagePreferences 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); @@ -1098,34 +1587,55 @@ class MockUIViewWKWebView extends _i1.Mock implements _i2.UIViewWKWebView { @override _i2.WKWebViewConfiguration pigeonVar_configuration() => (super.noSuchMethod( - Invocation.method(#pigeonVar_configuration, []), + Invocation.method( + #pigeonVar_configuration, + [], + ), returnValue: _FakeWKWebViewConfiguration_12( this, - Invocation.method(#pigeonVar_configuration, []), + Invocation.method( + #pigeonVar_configuration, + [], + ), ), 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); @@ -1133,93 +1643,144 @@ 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); @@ -1227,14 +1788,20 @@ 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); @@ -1242,55 +1809,82 @@ 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 _i3.Future setAllowsLinkPreview(bool? allow) => (super.noSuchMethod( - Invocation.method(#setAllowsLinkPreview, [allow]), + Invocation.method( + #setAllowsLinkPreview, + [allow], + ), returnValue: _i3.Future.value(), returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override _i2.UIViewWKWebView pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeUIViewWKWebView_13( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), 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); @@ -1302,15 +1896,31 @@ 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); @@ -1349,14 +1959,23 @@ class MockWKWebsiteDataStore extends _i1.Mock @override _i2.WKHTTPCookieStore pigeonVar_httpCookieStore() => (super.noSuchMethod( - Invocation.method(#pigeonVar_httpCookieStore, []), + Invocation.method( + #pigeonVar_httpCookieStore, + [], + ), returnValue: _FakeWKHTTPCookieStore_14( this, - Invocation.method(#pigeonVar_httpCookieStore, []), + Invocation.method( + #pigeonVar_httpCookieStore, + [], + ), ), returnValueForMissingStub: _FakeWKHTTPCookieStore_14( this, - Invocation.method(#pigeonVar_httpCookieStore, []), + Invocation.method( + #pigeonVar_httpCookieStore, + [], + ), ), ) as _i2.WKHTTPCookieStore); @@ -1366,24 +1985,36 @@ 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); @@ -1394,15 +2025,31 @@ 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 d494fbba2091..ddf329765f33 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.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_wkwebview/test/webkit_webview_cookie_manager_test.dart. // Do not manually edit this file. @@ -24,20 +24,35 @@ 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]. @@ -69,10 +84,16 @@ 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); @@ -82,19 +103,28 @@ 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); @@ -105,15 +135,31 @@ 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); @@ -138,17 +184,26 @@ 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); @@ -159,15 +214,31 @@ 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 ce4ab60e4a0e..c25e07f617dd 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.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in webview_flutter_wkwebview/test/webkit_webview_widget_test.dart. // Do not manually edit this file. @@ -24,48 +24,88 @@ 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 _FakeWKWebpagePreferences_5 extends _i1.SmartFake implements _i2.WKWebpagePreferences { - _FakeWKWebpagePreferences_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWKWebpagePreferences_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWKWebViewConfiguration_6 extends _i1.SmartFake implements _i2.WKWebViewConfiguration { - _FakeWKWebViewConfiguration_6(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWKWebViewConfiguration_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUIScrollViewDelegate_7 extends _i1.SmartFake implements _i2.UIScrollViewDelegate { - _FakeUIScrollViewDelegate_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeUIScrollViewDelegate_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [WKUIDelegate]. @@ -93,8 +133,7 @@ class MockWKUIDelegate extends _i1.Mock implements _i2.WKUIDelegate { _i2.MediaCaptureType type, ) => _i3.Future<_i2.PermissionDecision>.value( - _i2.PermissionDecision.deny, - ), + _i2.PermissionDecision.deny), ) as _i3.Future<_i2.PermissionDecision> Function( _i2.WKUIDelegate, _i2.WKWebView, @@ -136,10 +175,16 @@ 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); @@ -150,15 +195,31 @@ 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); @@ -184,10 +245,12 @@ 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); @@ -195,19 +258,27 @@ 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); @@ -215,38 +286,53 @@ 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); @@ -254,19 +340,22 @@ 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); @@ -274,21 +363,32 @@ class MockWKWebViewConfiguration extends _i1.Mock @override _i3.Future<_i2.WKWebpagePreferences> getDefaultWebpagePreferences() => (super.noSuchMethod( - Invocation.method(#getDefaultWebpagePreferences, []), + Invocation.method( + #getDefaultWebpagePreferences, + [], + ), returnValue: _i3.Future<_i2.WKWebpagePreferences>.value( - _FakeWKWebpagePreferences_5( - this, - Invocation.method(#getDefaultWebpagePreferences, []), + _FakeWKWebpagePreferences_5( + this, + Invocation.method( + #getDefaultWebpagePreferences, + [], ), - ), + )), ) as _i3.Future<_i2.WKWebpagePreferences>); @override _i2.WKWebViewConfiguration pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeWKWebViewConfiguration_6( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.WKWebViewConfiguration); @@ -299,15 +399,31 @@ 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); @@ -333,10 +449,16 @@ class MockUIScrollViewDelegate extends _i1.Mock @override _i2.UIScrollViewDelegate pigeon_copy() => (super.noSuchMethod( - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), returnValue: _FakeUIScrollViewDelegate_7( this, - Invocation.method(#pigeon_copy, []), + Invocation.method( + #pigeon_copy, + [], + ), ), ) as _i2.UIScrollViewDelegate); @@ -347,15 +469,31 @@ 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); From c0ea481b57b28705053ee12f75d44062f4b0960a Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:46:24 -0400 Subject: [PATCH 29/34] fix swift side --- ...ionChallengeResponseProxyAPIDelegate.swift | 4 + .../NavigationDelegateProxyAPIDelegate.swift | 46 +- .../URLCredentialProxyAPIDelegate.swift | 8 + .../WebKitLibrary.g.swift | 4164 +---------------- .../example/lib/main.dart | 4 +- .../lib/src/common/web_kit.g.dart | 296 +- .../webview_flutter_wkwebview/pubspec.yaml | 6 +- 7 files changed, 202 insertions(+), 4326 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift index 7367e71990b6..a820fa7f6922 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift @@ -33,6 +33,10 @@ class AuthenticationChallengeResponseProxyAPIDelegate: return AuthenticationChallengeResponse(disposition: nativeDisposition, credential: credential) } + + func createAsync(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, completion: @escaping (Result) -> Void) { + completion(Result.success(try! pigeonDefaultConstructor(pigeonApi: pigeonApi, disposition: disposition, credential: credential))) + } func disposition( pigeonApi: PigeonApiAuthenticationChallengeResponse, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift index 8735fddf4c60..4988bb60228a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/NavigationDelegateProxyAPIDelegate.swift @@ -230,46 +230,6 @@ public class NavigationDelegateImpl: NSObject, WKNavigationDelegate { } #endif - func handleAuthChallengeSuccessResponse(_ response: [Any?]) -> ( - URLSession.AuthChallengeDisposition, URLCredential? - ) { - let disposition = response[0] as! UrlSessionAuthChallengeDisposition - var nativeDisposition: URLSession.AuthChallengeDisposition - switch disposition { - case .useCredential: - nativeDisposition = .useCredential - case .performDefaultHandling: - nativeDisposition = .performDefaultHandling - case .cancelAuthenticationChallenge: - nativeDisposition = .cancelAuthenticationChallenge - case .rejectProtectionSpace: - nativeDisposition = .rejectProtectionSpace - case .unknown: - print( - self.registrar.createUnknownEnumError(withEnum: disposition).localizedDescription) - nativeDisposition = .cancelAuthenticationChallenge - } - let credentialMap = response[1] as? [AnyHashable?: AnyHashable?] - var credential: URLCredential? - if let credentialMap = credentialMap { - let nativePersistence: URLCredential.Persistence - switch credentialMap["persistence"] as! UrlCredentialPersistence { - case .none: - nativePersistence = .none - case .forSession: - nativePersistence = .forSession - case .permanent: - nativePersistence = .permanent - case .synchronizable: - nativePersistence = .synchronizable - } - credential = URLCredential( - user: credentialMap["user"] as! String, - password: credentialMap["password"] as! String, persistence: nativePersistence) - } - return (nativeDisposition, credential) - } - #if compiler(>=6.0) public func webView( _ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, @@ -284,8 +244,7 @@ public class NavigationDelegateImpl: NSObject, WKNavigationDelegate { DispatchQueue.main.async { switch result { case .success(let response): - let nativeValues = self.handleAuthChallengeSuccessResponse(response) - completionHandler(nativeValues.0, nativeValues.1) + completionHandler(response.disposition, response.credential) case .failure(let error): completionHandler(.cancelAuthenticationChallenge, nil) onFailure("WKNavigationDelegate.didReceiveAuthenticationChallenge", error) @@ -307,8 +266,7 @@ public class NavigationDelegateImpl: NSObject, WKNavigationDelegate { DispatchQueue.main.async { switch result { case .success(let response): - let nativeValues = self.handleAuthChallengeSuccessResponse(response) - completionHandler(nativeValues.0, nativeValues.1) + completionHandler(response.disposition, response.credential) case .failure(let error): completionHandler(.cancelAuthenticationChallenge, nil) onFailure("WKNavigationDelegate.didReceiveAuthenticationChallenge", error) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift index d19f89bc3346..1f85b96adbf9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift @@ -26,4 +26,12 @@ class URLCredentialProxyAPIDelegate: PigeonApiDelegateURLCredential { } return URLCredential(user: user, password: password, persistence: nativePersistence) } + + func withUserAsync(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence, completion: @escaping (Result) -> Void) { + completion(Result.success(try! withUser(pigeonApi: pigeonApi, user: user, password: password, persistence: persistence))) + } + + func serverTrustAsync(pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) { + completion(Result.success(URLCredential(trust: trust.value))) + } } 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 a58e32c238bb..6f8403c392c3 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 @@ -1678,188 +1678,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URLRequest`. -/// -/// 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 URLRequestWrapperProxyAPIDelegate : PigeonApiDelegateURLRequest { - func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws -> URLRequestWrapper { - return URLRequest(,url: url) - } - - func getUrl(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? { - return pigeonInstance.url - } - - func setHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws { - pigeonInstance.httpMethod = method: method - } - - func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? { - return pigeonInstance.httpMethod - } - - func setHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, body: FlutterStandardTypedData?) throws { - pigeonInstance.httpBody = body: body - } - - func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> FlutterStandardTypedData? { - return pigeonInstance.httpBody - } - - func setAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) throws { - pigeonInstance.allHttpHeaderFields = fields: fields - } - - func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> [String: String]? { - return pigeonInstance.allHttpHeaderFields - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLRequestWrapperProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: "myString") - XCTAssertNotNil(instance) - } - - func testGetUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getUrlCalled) - XCTAssertEqual(value, instance.getUrl()) - } - - func testSetHttpMethod() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let method = "myString" - api.pigeonDelegate.setHttpMethod(pigeonApi: api, pigeonInstance: instance, method: method) - - XCTAssertEqual(instance.setHttpMethodArgs, [method]) - } - - func testGetHttpMethod() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let value = api.pigeonDelegate.getHttpMethod(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getHttpMethodCalled) - XCTAssertEqual(value, instance.getHttpMethod()) - } - - func testSetHttpBody() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let body = byteArrayOf(0xA1.toByte()) - api.pigeonDelegate.setHttpBody(pigeonApi: api, pigeonInstance: instance, body: body) - - XCTAssertEqual(instance.setHttpBodyArgs, [body]) - } - - func testGetHttpBody() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let value = api.pigeonDelegate.getHttpBody(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getHttpBodyCalled) - XCTAssertEqual(value, instance.getHttpBody()) - } - - func testSetAllHttpHeaderFields() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let fields = ["myString": "myString"] - api.pigeonDelegate.setAllHttpHeaderFields(pigeonApi: api, pigeonInstance: instance, fields: fields) - - XCTAssertEqual(instance.setAllHttpHeaderFieldsArgs, [fields]) - } - - func testGetAllHttpHeaderFields() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLRequest(registrar) - - let instance = TestURLRequestWrapper() - let value = api.pigeonDelegate.getAllHttpHeaderFields(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getAllHttpHeaderFieldsCalled) - XCTAssertEqual(value, instance.getAllHttpHeaderFields()) - } - -} -class TestURLRequestWrapper: URLRequest { - var getUrlCalled = false - var setHttpMethodArgs: [AnyHashable?]? = nil - var getHttpMethodCalled = false - var setHttpBodyArgs: [AnyHashable?]? = nil - var getHttpBodyCalled = false - var setAllHttpHeaderFieldsArgs: [AnyHashable?]? = nil - var getAllHttpHeaderFieldsCalled = false - - - override func getUrl() { - getUrlCalled = true - } - override func setHttpMethod() { - setHttpMethodArgs = [method] - } - override func getHttpMethod() { - getHttpMethodCalled = true - } - override func setHttpBody() { - setHttpBodyArgs = [body] - } - override func getHttpBody() { - getHttpBodyCalled = true - } - override func setAllHttpHeaderFields() { - setAllHttpHeaderFieldsArgs = [fields] - } - override func getAllHttpHeaderFields() { - getAllHttpHeaderFieldsCalled = true - } -} -*/ - protocol PigeonApiDelegateHTTPURLResponse { /// The response’s HTTP status code. func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 @@ -1914,53 +1732,6 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `HTTPURLResponse`. -/// -/// 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 HTTPURLResponseProxyAPIDelegate : PigeonApiDelegateHTTPURLResponse { - func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 { - return pigeonInstance.statusCode - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class HTTPURLResponseProxyAPITests: XCTestCase { - func testStatusCode() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiHTTPURLResponse(registrar) - - let instance = TestHTTPURLResponse() - let value = try? api.pigeonDelegate.statusCode(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.statusCode) - } - -} -*/ - open class PigeonApiDelegateURLResponse { } @@ -2104,100 +1875,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKUserScript`. -/// -/// 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 UserScriptProxyAPIDelegate : PigeonApiDelegateWKUserScript { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, isForMainFrameOnly: Bool) throws -> WKUserScript { - return WKUserScript() - } - - func source(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> String { - return pigeonInstance.source - } - - func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> UserScriptInjectionTime { - switch pigeonInstance.injectionTime { - case .atDocumentStart: - return .atDocumentStart - case .atDocumentEnd: - return .atDocumentEnd - @unknown default: - return .unknown - } - } - - func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> Bool { - return pigeonInstance.isForMainFrameOnly - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class UserScriptProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api source: "myString", injectionTime: .atDocumentStart, isForMainFrameOnly: true) - XCTAssertNotNil(instance) - } - - func testSource() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) - - let instance = TestUserScript() - let value = try? api.pigeonDelegate.source(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.source) - } - - func testInjectionTime() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) - - let instance = TestUserScript() - let value = try? api.pigeonDelegate.injectionTime(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.injectionTime) - } - - func testIsForMainFrameOnly() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserScript(registrar) - - let instance = TestUserScript() - let value = try? api.pigeonDelegate.isForMainFrameOnly(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.isForMainFrameOnly) - } - -} -*/ - protocol PigeonApiDelegateWKNavigationAction { /// The URL request object associated with the navigation action. func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper @@ -2260,96 +1937,6 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKNavigationAction`. -/// -/// 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 NavigationActionProxyAPIDelegate : PigeonApiDelegateWKNavigationAction { - func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper { - return pigeonInstance.request - } - - func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> WKFrameInfo? { - return pigeonInstance.targetFrame - } - - func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> NavigationType { - switch pigeonInstance.navigationType { - case .linkActivated: - return .linkActivated - case .formSubmitted: - return .formSubmitted - case .backForward: - return .backForward - case .reload: - return .reload - case .formResubmitted: - return .formResubmitted - case .other: - return .other - @unknown default: - return .unknown - } - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class NavigationActionProxyAPITests: XCTestCase { - func testRequest() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) - - let instance = TestNavigationAction() - let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.request) - } - - func testTargetFrame() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) - - let instance = TestNavigationAction() - let value = try? api.pigeonDelegate.targetFrame(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.targetFrame) - } - - func testNavigationType() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationAction(registrar) - - let instance = TestNavigationAction() - let value = try? api.pigeonDelegate.navigationType(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.navigationType) - } - -} -*/ - protocol PigeonApiDelegateWKNavigationResponse { /// The frame’s response. func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse @@ -2408,67 +1995,6 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKNavigationResponse`. -/// -/// 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 NavigationResponseProxyAPIDelegate : PigeonApiDelegateWKNavigationResponse { - func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse { - return pigeonInstance.response - } - - func isForMainFrame(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> Bool { - return pigeonInstance.isForMainFrame - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class NavigationResponseProxyAPITests: XCTestCase { - func testResponse() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationResponse(registrar) - - let instance = TestNavigationResponse() - let value = try? api.pigeonDelegate.response(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.response) - } - - func testIsForMainFrame() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationResponse(registrar) - - let instance = TestNavigationResponse() - let value = try? api.pigeonDelegate.isForMainFrame(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.isForMainFrame) - } - -} -*/ - protocol PigeonApiDelegateWKFrameInfo { /// A Boolean value indicating whether the frame is the web site's main frame /// or a subframe. @@ -2527,67 +2053,6 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKFrameInfo`. -/// -/// 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 FrameInfoProxyAPIDelegate : PigeonApiDelegateWKFrameInfo { - func isMainFrame(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> Bool { - return pigeonInstance.isMainFrame - } - - func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> URLRequestWrapper? { - return pigeonInstance.request - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class FrameInfoProxyAPITests: XCTestCase { - func testIsMainFrame() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) - - let instance = TestFrameInfo() - let value = try? api.pigeonDelegate.isMainFrame(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.isMainFrame) - } - - func testRequest() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKFrameInfo(registrar) - - let instance = TestFrameInfo() - let value = try? api.pigeonDelegate.request(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.request) - } - -} -*/ - protocol PigeonApiDelegateNSError { /// The error code. func code(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> Int64 @@ -2648,81 +2113,6 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `NSError`. -/// -/// 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 ErrorProxyAPIDelegate : PigeonApiDelegateNSError { - func code(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> Int64 { - return pigeonInstance.code - } - - func domain(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> String { - return pigeonInstance.domain - } - - func userInfo(pigeonApi: PigeonApiNSError, pigeonInstance: NSError) throws -> [String: Any?] { - return pigeonInstance.userInfo - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ErrorProxyAPITests: XCTestCase { - func testCode() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSError(registrar) - - let instance = TestError() - let value = try? api.pigeonDelegate.code(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.code) - } - - func testDomain() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSError(registrar) - - let instance = TestError() - let value = try? api.pigeonDelegate.domain(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.domain) - } - - func testUserInfo() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSError(registrar) - - let instance = TestError() - let value = try? api.pigeonDelegate.userInfo(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.userInfo) - } - -} -*/ - protocol PigeonApiDelegateWKScriptMessage { /// The name of the message handler to which the message is sent. func name(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> String @@ -2780,67 +2170,6 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKScriptMessage`. -/// -/// 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 ScriptMessageProxyAPIDelegate : PigeonApiDelegateWKScriptMessage { - func name(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> String { - return pigeonInstance.name - } - - func body(pigeonApi: PigeonApiWKScriptMessage, pigeonInstance: WKScriptMessage) throws -> Any? { - return pigeonInstance.body - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ScriptMessageProxyAPITests: XCTestCase { - func testName() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKScriptMessage(registrar) - - let instance = TestScriptMessage() - let value = try? api.pigeonDelegate.name(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.name) - } - - func testBody() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKScriptMessage(registrar) - - let instance = TestScriptMessage() - let value = try? api.pigeonDelegate.body(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.body) - } - -} -*/ - protocol PigeonApiDelegateWKSecurityOrigin { /// The security origin’s host. func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String @@ -2901,81 +2230,6 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKSecurityOrigin`. -/// -/// 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 SecurityOriginProxyAPIDelegate : PigeonApiDelegateWKSecurityOrigin { - func host(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String { - return pigeonInstance.host - } - - func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 { - return pigeonInstance.port - } - - func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String { - return pigeonInstance.securityProtocol - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class SecurityOriginProxyAPITests: XCTestCase { - func testHost() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) - - let instance = TestSecurityOrigin() - let value = try? api.pigeonDelegate.host(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.host) - } - - func testPort() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) - - let instance = TestSecurityOrigin() - let value = try? api.pigeonDelegate.port(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.port) - } - - func testSecurityProtocol() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKSecurityOrigin(registrar) - - let instance = TestSecurityOrigin() - let value = try? api.pigeonDelegate.securityProtocol(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.securityProtocol) - } - -} -*/ - protocol PigeonApiDelegateHTTPCookie { func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie /// The cookie’s properties. @@ -3071,75 +2325,11 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `HTTPCookie`. -/// -/// 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 HTTPCookieProxyAPIDelegate : PigeonApiDelegateHTTPCookie { - func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie { - return HTTPCookie(,properties: properties) - } - - func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws -> [HttpCookiePropertyKey: Any]? { - return pigeonInstance.properties - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class HTTPCookieProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiHTTPCookie(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, properties: [.comment: -1]) - XCTAssertNotNil(instance) - } - - func testGetProperties() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiHTTPCookie(registrar) - - let instance = TestHTTPCookie() - let value = api.pigeonDelegate.getProperties(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getPropertiesCalled) - XCTAssertEqual(value, instance.getProperties()) - } - -} -class TestHTTPCookie: HTTPCookie { - var getPropertiesCalled = false - - - override func getProperties() { - getPropertiesCalled = true - } -} -*/ - protocol PigeonApiDelegateAuthenticationChallengeResponse { + /// Creates an [AuthenticationChallengeResponse]. + /// + /// Due to https://github.com/flutter/flutter/issues/162437, this should only + /// be used for testing. func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse /// The option to use to handle the challenge. func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition @@ -3244,94 +2434,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `AuthenticationChallengeResponse`. -/// -/// 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 AuthenticationChallengeResponseProxyAPIDelegate : PigeonApiDelegateAuthenticationChallengeResponse { - func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse { - return AuthenticationChallengeResponse() - } - - func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition { - switch pigeonInstance.disposition { - case .useCredential: - return .useCredential - case .performDefaultHandling: - return .performDefaultHandling - case .cancelAuthenticationChallenge: - return .cancelAuthenticationChallenge - case .rejectProtectionSpace: - return .rejectProtectionSpace - @unknown default: - return .unknown - } - } - - func credential(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> URLCredential? { - return pigeonInstance.credential - } - - func createAsync(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, completion: @escaping (Result) -> Void) { - return AuthenticationChallengeResponse.createAsync(disposition: disposition, credential: credential) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class AuthenticationChallengeResponseProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api disposition: .useCredential, credential: TestURLCredential) - XCTAssertNotNil(instance) - } - - func testDisposition() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) - - let instance = TestAuthenticationChallengeResponse() - let value = try? api.pigeonDelegate.disposition(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.disposition) - } - - func testCredential() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(registrar) - - let instance = TestAuthenticationChallengeResponse() - let value = try? api.pigeonDelegate.credential(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.credential) - } - -} -*/ - protocol PigeonApiDelegateWKWebsiteDataStore { /// The default data store, which stores data persistently to disk. func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore) throws -> WKWebsiteDataStore @@ -3447,87 +2549,6 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKWebsiteDataStore`. -/// -/// 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 WebsiteDataStoreProxyAPIDelegate : PigeonApiDelegateWKWebsiteDataStore { - func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore): WKWebsiteDataStore { - return WKWebsiteDataStore.defaultDataStore - } - - func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore): WKHTTPCookieStore { - return pigeonInstance.httpCookieStore - } - - func removeDataOfTypes(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, completion: @escaping (Result) -> Void) { - return pigeonInstance.removeDataOfTypes(dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebsiteDataStoreProxyAPITests: XCTestCase { - func testHttpCookieStore() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebsiteDataStore(registrar) - - let instance = TestWebsiteDataStore() - let value = try? api.pigeonDelegate.httpCookieStore(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.httpCookieStore) - } - - func testRemoveDataOfTypes() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebsiteDataStore(registrar) - - let instance = TestWebsiteDataStore() - let dataTypes = [.cookies] - let modificationTimeInSecondsSinceEpoch = 1.0 - let value = api.pigeonDelegate.removeDataOfTypes(pigeonApi: api, pigeonInstance: instance, dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch) - - XCTAssertEqual(instance.removeDataOfTypesArgs, [dataTypes, modificationTimeInSecondsSinceEpoch]) - XCTAssertEqual(value, instance.removeDataOfTypes(dataTypes: dataTypes, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpoch)) - } - -} -class TestWebsiteDataStore: WKWebsiteDataStore { - private var httpCookieStoreTestValue = TestHTTPCookieStore - var removeDataOfTypesArgs: [AnyHashable?]? = nil - - override var httpCookieStore: WKHTTPCookieStore { - return httpCookieStoreTestValue - } - - override func removeDataOfTypes() { - removeDataOfTypesArgs = [dataTypes, modificationTimeInSecondsSinceEpoch] - return true - } -} -*/ - protocol PigeonApiDelegateUIView { #if !os(macOS) /// The view’s background color. @@ -3633,81 +2654,6 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { } #endif } - -/* -// 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 Foundation -import UIKit - - -/// ProxyApi implementation for `UIView`. -/// -/// 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 ViewProxyAPIDelegate : PigeonApiDelegateUIView { - func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) throws { - pigeonInstance.backgroundColor = value: value - } - - func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws { - pigeonInstance.opaque = opaque: opaque - } - -} -*/ - -/* -// 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 UIKit -import Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ViewProxyAPITests: XCTestCase { - func testSetBackgroundColor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIView(registrar) - - let instance = TestView() - let value = 0 - api.pigeonDelegate.setBackgroundColor(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setBackgroundColorArgs, [value]) - } - - func testSetOpaque() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIView(registrar) - - let instance = TestView() - let opaque = true - api.pigeonDelegate.setOpaque(pigeonApi: api, pigeonInstance: instance, opaque: opaque) - - XCTAssertEqual(instance.setOpaqueArgs, [opaque]) - } - -} -class TestView: UIView { - var setBackgroundColorArgs: [AnyHashable?]? = nil - var setOpaqueArgs: [AnyHashable?]? = nil - - - override func setBackgroundColor() { - setBackgroundColorArgs = [value] - } - override func setOpaque() { - setOpaqueArgs = [opaque] - } -} -*/ - protocol PigeonApiDelegateUIScrollView { #if !os(macOS) /// The point at which the origin of the content view is offset from the @@ -3984,216 +2930,6 @@ final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { } #endif } - -/* -// 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 Foundation -import UIKit - - -/// ProxyApi implementation for `UIScrollView`. -/// -/// 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 ScrollViewProxyAPIDelegate : PigeonApiDelegateUIScrollView { - func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws -> [Double] { - return pigeonInstance.contentOffset - } - - func scrollBy(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws { - pigeonInstance.scrollBy(x: x, y: y) - } - - func setContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws { - pigeonInstance.setContentOffset(x: x, y: y) - } - - func setDelegate(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, delegate: UIScrollViewDelegate?) throws { - pigeonInstance.delegate = delegate: delegate - } - - func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.bounces = value: value - } - - func setBouncesHorizontally(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.bouncesHorizontally = value: value - } - - func setBouncesVertically(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.bouncesVertically = value: value - } - - func setAlwaysBounceVertical(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.alwaysBounceVertical = value: value - } - - func setAlwaysBounceHorizontal(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws { - pigeonInstance.alwaysBounceHorizontal = value: value - } - -} -*/ - -/* -// 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 UIKit -import Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ScrollViewProxyAPITests: XCTestCase { - func testGetContentOffset() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = api.pigeonDelegate.getContentOffset(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getContentOffsetCalled) - XCTAssertEqual(value, instance.getContentOffset()) - } - - func testScrollBy() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let x = 1.0 - let y = 1.0 - api.pigeonDelegate.scrollBy(pigeonApi: api, pigeonInstance: instance, x: x, y: y) - - XCTAssertEqual(instance.scrollByArgs, [x, y]) - } - - func testSetContentOffset() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let x = 1.0 - let y = 1.0 - api.pigeonDelegate.setContentOffset(pigeonApi: api, pigeonInstance: instance, x: x, y: y) - - XCTAssertEqual(instance.setContentOffsetArgs, [x, y]) - } - - func testSetDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let delegate = TestScrollViewDelegate - api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setDelegateArgs, [delegate]) - } - - func testSetBounces() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setBounces(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setBouncesArgs, [value]) - } - - func testSetBouncesHorizontally() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setBouncesHorizontally(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setBouncesHorizontallyArgs, [value]) - } - - func testSetBouncesVertically() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setBouncesVertically(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setBouncesVerticallyArgs, [value]) - } - - func testSetAlwaysBounceVertical() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setAlwaysBounceVertical(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setAlwaysBounceVerticalArgs, [value]) - } - - func testSetAlwaysBounceHorizontal() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollView(registrar) - - let instance = TestScrollView() - let value = true - api.pigeonDelegate.setAlwaysBounceHorizontal(pigeonApi: api, pigeonInstance: instance, value: value) - - XCTAssertEqual(instance.setAlwaysBounceHorizontalArgs, [value]) - } - -} -class TestScrollView: UIScrollView { - var getContentOffsetCalled = false - var scrollByArgs: [AnyHashable?]? = nil - var setContentOffsetArgs: [AnyHashable?]? = nil - var setDelegateArgs: [AnyHashable?]? = nil - var setBouncesArgs: [AnyHashable?]? = nil - var setBouncesHorizontallyArgs: [AnyHashable?]? = nil - var setBouncesVerticallyArgs: [AnyHashable?]? = nil - var setAlwaysBounceVerticalArgs: [AnyHashable?]? = nil - var setAlwaysBounceHorizontalArgs: [AnyHashable?]? = nil - - - override func getContentOffset() { - getContentOffsetCalled = true - } - override func scrollBy() { - scrollByArgs = [x, y] - } - override func setContentOffset() { - setContentOffsetArgs = [x, y] - } - override func setDelegate() { - setDelegateArgs = [delegate] - } - override func setBounces() { - setBouncesArgs = [value] - } - override func setBouncesHorizontally() { - setBouncesHorizontallyArgs = [value] - } - override func setBouncesVertically() { - setBouncesVerticallyArgs = [value] - } - override func setAlwaysBounceVertical() { - setAlwaysBounceVerticalArgs = [value] - } - override func setAlwaysBounceHorizontal() { - setAlwaysBounceHorizontalArgs = [value] - } -} -*/ - protocol PigeonApiDelegateWKWebViewConfiguration { func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration /// The object that coordinates interactions between your app’s native code @@ -4470,245 +3206,6 @@ withIdentifier: pigeonIdentifierArg) } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKWebViewConfiguration`. -/// -/// 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 WebViewConfigurationProxyAPIDelegate : PigeonApiDelegateWKWebViewConfiguration { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration { - return WKWebViewConfiguration() - } - - func setUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, controller: WKUserContentController) throws { - pigeonInstance.userContentController = controller: controller - } - - func getUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKUserContentController { - return pigeonInstance.userContentController - } - - func setWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, dataStore: WKWebsiteDataStore) throws { - pigeonInstance.websiteDataStore = dataStore: dataStore - } - - func getWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebsiteDataStore { - return pigeonInstance.websiteDataStore - } - - func setPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, preferences: WKPreferences) throws { - pigeonInstance.preferences = preferences: preferences - } - - func getPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKPreferences { - return pigeonInstance.preferences - } - - func setAllowsInlineMediaPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) throws { - pigeonInstance.allowsInlineMediaPlayback = allow: allow - } - - func setLimitsNavigationsToAppBoundDomains(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) throws { - pigeonInstance.limitsNavigationsToAppBoundDomains = limit: limit - } - - func setMediaTypesRequiringUserActionForPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, type: AudiovisualMediaType) throws { - pigeonInstance.mediaTypesRequiringUserActionForPlayback = type: type - } - - func getDefaultWebpagePreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebpagePreferences { - return pigeonInstance.defaultWebpagePreferences - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebViewConfigurationProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testSetUserContentController() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let controller = TestUserContentController - api.pigeonDelegate.setUserContentController(pigeonApi: api, pigeonInstance: instance, controller: controller) - - XCTAssertEqual(instance.setUserContentControllerArgs, [controller]) - } - - func testGetUserContentController() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let value = api.pigeonDelegate.getUserContentController(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getUserContentControllerCalled) - XCTAssertEqual(value, instance.getUserContentController()) - } - - func testSetWebsiteDataStore() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let dataStore = TestWebsiteDataStore - api.pigeonDelegate.setWebsiteDataStore(pigeonApi: api, pigeonInstance: instance, dataStore: dataStore) - - XCTAssertEqual(instance.setWebsiteDataStoreArgs, [dataStore]) - } - - func testGetWebsiteDataStore() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let value = api.pigeonDelegate.getWebsiteDataStore(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getWebsiteDataStoreCalled) - XCTAssertEqual(value, instance.getWebsiteDataStore()) - } - - func testSetPreferences() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let preferences = TestPreferences - api.pigeonDelegate.setPreferences(pigeonApi: api, pigeonInstance: instance, preferences: preferences) - - XCTAssertEqual(instance.setPreferencesArgs, [preferences]) - } - - func testGetPreferences() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let value = api.pigeonDelegate.getPreferences(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getPreferencesCalled) - XCTAssertEqual(value, instance.getPreferences()) - } - - func testSetAllowsInlineMediaPlayback() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let allow = true - api.pigeonDelegate.setAllowsInlineMediaPlayback(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsInlineMediaPlaybackArgs, [allow]) - } - - func testSetLimitsNavigationsToAppBoundDomains() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let limit = true - api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains(pigeonApi: api, pigeonInstance: instance, limit: limit) - - XCTAssertEqual(instance.setLimitsNavigationsToAppBoundDomainsArgs, [limit]) - } - - func testSetMediaTypesRequiringUserActionForPlayback() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let type = .none - api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback(pigeonApi: api, pigeonInstance: instance, type: type) - - XCTAssertEqual(instance.setMediaTypesRequiringUserActionForPlaybackArgs, [type]) - } - - func testGetDefaultWebpagePreferences() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebViewConfiguration(registrar) - - let instance = TestWebViewConfiguration() - let value = api.pigeonDelegate.getDefaultWebpagePreferences(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getDefaultWebpagePreferencesCalled) - XCTAssertEqual(value, instance.getDefaultWebpagePreferences()) - } - -} -class TestWebViewConfiguration: WKWebViewConfiguration { - var setUserContentControllerArgs: [AnyHashable?]? = nil - var getUserContentControllerCalled = false - var setWebsiteDataStoreArgs: [AnyHashable?]? = nil - var getWebsiteDataStoreCalled = false - var setPreferencesArgs: [AnyHashable?]? = nil - var getPreferencesCalled = false - var setAllowsInlineMediaPlaybackArgs: [AnyHashable?]? = nil - var setLimitsNavigationsToAppBoundDomainsArgs: [AnyHashable?]? = nil - var setMediaTypesRequiringUserActionForPlaybackArgs: [AnyHashable?]? = nil - var getDefaultWebpagePreferencesCalled = false - - - override func setUserContentController() { - setUserContentControllerArgs = [controller] - } - override func getUserContentController() { - getUserContentControllerCalled = true - } - override func setWebsiteDataStore() { - setWebsiteDataStoreArgs = [dataStore] - } - override func getWebsiteDataStore() { - getWebsiteDataStoreCalled = true - } - override func setPreferences() { - setPreferencesArgs = [preferences] - } - override func getPreferences() { - getPreferencesCalled = true - } - override func setAllowsInlineMediaPlayback() { - setAllowsInlineMediaPlaybackArgs = [allow] - } - override func setLimitsNavigationsToAppBoundDomains() { - setLimitsNavigationsToAppBoundDomainsArgs = [limit] - } - override func setMediaTypesRequiringUserActionForPlayback() { - setMediaTypesRequiringUserActionForPlaybackArgs = [type] - } - override func getDefaultWebpagePreferences() { - getDefaultWebpagePreferencesCalled = true - } -} -*/ - protocol PigeonApiDelegateWKUserContentController { /// Installs a message handler that you can call from your JavaScript code. func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws @@ -4828,168 +3325,37 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont ///Creates a Dart instance of WKUserContentController and attaches it to [pigeonInstance]. func pigeonNewInstance(pigeonInstance: WKUserContentController, 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.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(())) - } - } - } - } -} - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKUserContentController`. -/// -/// 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 UserContentControllerProxyAPIDelegate : PigeonApiDelegateWKUserContentController { - func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws { - pigeonInstance.addScriptMessageHandler(handler: handler, name: name) - } - - func removeScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, name: String) throws { - pigeonInstance.removeScriptMessageHandler(name: name) - } - - func removeAllScriptMessageHandlers(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws { - pigeonInstance.removeAllScriptMessageHandlers() - } - - func addUserScript(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, userScript: WKUserScript) throws { - pigeonInstance.addUserScript(userScript: userScript) - } - - func removeAllUserScripts(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws { - pigeonInstance.removeAllUserScripts() - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class UserContentControllerProxyAPITests: XCTestCase { - func testAddScriptMessageHandler() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - let handler = TestScriptMessageHandler - let name = "myString" - api.pigeonDelegate.addScriptMessageHandler(pigeonApi: api, pigeonInstance: instance, handler: handler, name: name) - - XCTAssertEqual(instance.addScriptMessageHandlerArgs, [handler, name]) - } - - func testRemoveScriptMessageHandler() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - let name = "myString" - api.pigeonDelegate.removeScriptMessageHandler(pigeonApi: api, pigeonInstance: instance, name: name) - - XCTAssertEqual(instance.removeScriptMessageHandlerArgs, [name]) - } - - func testRemoveAllScriptMessageHandlers() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - api.pigeonDelegate.removeAllScriptMessageHandlers(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.removeAllScriptMessageHandlersCalled) - } - - func testAddUserScript() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - let userScript = TestUserScript - api.pigeonDelegate.addUserScript(pigeonApi: api, pigeonInstance: instance, userScript: userScript) - - XCTAssertEqual(instance.addUserScriptArgs, [userScript]) - } - - func testRemoveAllUserScripts() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUserContentController(registrar) - - let instance = TestUserContentController() - api.pigeonDelegate.removeAllUserScripts(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.removeAllUserScriptsCalled) - } - -} -class TestUserContentController: WKUserContentController { - var addScriptMessageHandlerArgs: [AnyHashable?]? = nil - var removeScriptMessageHandlerArgs: [AnyHashable?]? = nil - var removeAllScriptMessageHandlersCalled = false - var addUserScriptArgs: [AnyHashable?]? = nil - var removeAllUserScriptsCalled = false - - - override func addScriptMessageHandler() { - addScriptMessageHandlerArgs = [handler, name] - } - override func removeScriptMessageHandler() { - removeScriptMessageHandlerArgs = [name] - } - override func removeAllScriptMessageHandlers() { - removeAllScriptMessageHandlersCalled = true - } - override func addUserScript() { - addUserScriptArgs = [userScript] - } - override func removeAllUserScripts() { - removeAllUserScriptsCalled = true + 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.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(())) + } + } + } } } -*/ - protocol PigeonApiDelegateWKPreferences { /// A Boolean value that indicates whether JavaScript is enabled. func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws @@ -5067,62 +3433,6 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKPreferences`. -/// -/// 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 PreferencesProxyAPIDelegate : PigeonApiDelegateWKPreferences { - func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws { - pigeonInstance.javaScriptEnabled = enabled: enabled - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class PreferencesProxyAPITests: XCTestCase { - func testSetJavaScriptEnabled() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKPreferences(registrar) - - let instance = TestPreferences() - let enabled = true - api.pigeonDelegate.setJavaScriptEnabled(pigeonApi: api, pigeonInstance: instance, enabled: enabled) - - XCTAssertEqual(instance.setJavaScriptEnabledArgs, [enabled]) - } - -} -class TestPreferences: WKPreferences { - var setJavaScriptEnabledArgs: [AnyHashable?]? = nil - - - override func setJavaScriptEnabled() { - setJavaScriptEnabledArgs = [enabled] - } -} -*/ - protocol PigeonApiDelegateWKScriptMessageHandler { func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler } @@ -5218,80 +3528,6 @@ withIdentifier: pigeonIdentifierArg) } } - -/* -// 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 Foundation -import WebKit - -/// Implementation of `WKScriptMessageHandler` that calls to Dart in callback methods. -class ScriptMessageHandlerImpl: WKScriptMessageHandler { - let api: PigeonApiProtocolWKScriptMessageHandler - - init(api: PigeonApiProtocolWKScriptMessageHandler) { - self.api = api - } - - func fixMe() { - api.didReceiveScriptMessage(pigeonInstance: self, controller: controller, message: message) { _ in } - } -} - -/// ProxyApi implementation for `WKScriptMessageHandler`. -/// -/// 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 ScriptMessageHandlerProxyAPIDelegate : PigeonApiDelegateWKScriptMessageHandler { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler { - return WKScriptMessageHandlerImpl(api: pigeonApi) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ScriptMessageHandlerProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKScriptMessageHandler(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testDidReceiveScriptMessage() { - let api = TestScriptMessageHandlerApi() - let instance = ScriptMessageHandlerImpl(api: api) - let controller = TestUserContentController - let message = TestScriptMessage - instance.didReceiveScriptMessage(controller: controller, message: message) - - XCTAssertEqual(api.didReceiveScriptMessageArgs, [controller, message]) - } - -} -class TestScriptMessageHandlerApi: PigeonApiProtocolWKScriptMessageHandler { - var didReceiveScriptMessageArgs: [AnyHashable?]? = nil - - func didReceiveScriptMessage(controller: WKUserContentController, message: WKScriptMessage) throws { - didReceiveScriptMessageArgs = [controllerArg, messageArg] - } -} -*/ - protocol PigeonApiDelegateWKNavigationDelegate { func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate } @@ -5626,205 +3862,6 @@ withIdentifier: pigeonIdentifierArg) } } - -/* -// 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 Foundation -import WebKit - -/// Implementation of `WKNavigationDelegate` that calls to Dart in callback methods. -class NavigationDelegateImpl: WKNavigationDelegate { - let api: PigeonApiProtocolWKNavigationDelegate - - init(api: PigeonApiProtocolWKNavigationDelegate) { - self.api = api - } - - func fixMe() { - api.didFinishNavigation(pigeonInstance: self, webView: webView, url: url) { _ in } - } - - func fixMe() { - api.didStartProvisionalNavigation(pigeonInstance: self, webView: webView, url: url) { _ in } - } - - func fixMe() { - api.decidePolicyForNavigationAction(pigeonInstance: self, webView: webView, navigationAction: navigationAction) { _ in } - } - - func fixMe() { - api.decidePolicyForNavigationResponse(pigeonInstance: self, webView: webView, navigationResponse: navigationResponse) { _ in } - } - - func fixMe() { - api.didFailNavigation(pigeonInstance: self, webView: webView, error: error) { _ in } - } - - func fixMe() { - api.didFailProvisionalNavigation(pigeonInstance: self, webView: webView, error: error) { _ in } - } - - func fixMe() { - api.webViewWebContentProcessDidTerminate(pigeonInstance: self, webView: webView) { _ in } - } - - func fixMe() { - api.didReceiveAuthenticationChallenge(pigeonInstance: self, webView: webView, challenge: challenge) { _ in } - } -} - -/// ProxyApi implementation for `WKNavigationDelegate`. -/// -/// 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 NavigationDelegateProxyAPIDelegate : PigeonApiDelegateWKNavigationDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate { - return WKNavigationDelegateImpl(api: pigeonApi) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class NavigationDelegateProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKNavigationDelegate(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testDidFinishNavigation() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let url = "myString" - instance.didFinishNavigation(webView: webView, url: url) - - XCTAssertEqual(api.didFinishNavigationArgs, [webView, url]) - } - - func testDidStartProvisionalNavigation() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let url = "myString" - instance.didStartProvisionalNavigation(webView: webView, url: url) - - XCTAssertEqual(api.didStartProvisionalNavigationArgs, [webView, url]) - } - - func testDecidePolicyForNavigationAction() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let navigationAction = TestNavigationAction - instance.decidePolicyForNavigationAction(webView: webView, navigationAction: navigationAction) - - XCTAssertEqual(api.decidePolicyForNavigationActionArgs, [webView, navigationAction]) - } - - func testDecidePolicyForNavigationResponse() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let navigationResponse = TestNavigationResponse - instance.decidePolicyForNavigationResponse(webView: webView, navigationResponse: navigationResponse) - - XCTAssertEqual(api.decidePolicyForNavigationResponseArgs, [webView, navigationResponse]) - } - - func testDidFailNavigation() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let error = TestError - instance.didFailNavigation(webView: webView, error: error) - - XCTAssertEqual(api.didFailNavigationArgs, [webView, error]) - } - - func testDidFailProvisionalNavigation() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let error = TestError - instance.didFailProvisionalNavigation(webView: webView, error: error) - - XCTAssertEqual(api.didFailProvisionalNavigationArgs, [webView, error]) - } - - func testWebViewWebContentProcessDidTerminate() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - instance.webViewWebContentProcessDidTerminate(webView: webView) - - XCTAssertEqual(api.webViewWebContentProcessDidTerminateArgs, [webView]) - } - - func testDidReceiveAuthenticationChallenge() { - let api = TestNavigationDelegateApi() - let instance = NavigationDelegateImpl(api: api) - let webView = TestWebView - let challenge = TestURLAuthenticationChallenge - instance.didReceiveAuthenticationChallenge(webView: webView, challenge: challenge) - - XCTAssertEqual(api.didReceiveAuthenticationChallengeArgs, [webView, challenge]) - } - -} -class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate { - var didFinishNavigationArgs: [AnyHashable?]? = nil - var didStartProvisionalNavigationArgs: [AnyHashable?]? = nil - var decidePolicyForNavigationActionArgs: [AnyHashable?]? = nil - var decidePolicyForNavigationResponseArgs: [AnyHashable?]? = nil - var didFailNavigationArgs: [AnyHashable?]? = nil - var didFailProvisionalNavigationArgs: [AnyHashable?]? = nil - var webViewWebContentProcessDidTerminateArgs: [AnyHashable?]? = nil - var didReceiveAuthenticationChallengeArgs: [AnyHashable?]? = nil - - func didFinishNavigation(webView: WKWebView, url: String?) throws { - didFinishNavigationArgs = [webViewArg, urlArg] - } - func didStartProvisionalNavigation(webView: WKWebView, url: String?) throws { - didStartProvisionalNavigationArgs = [webViewArg, urlArg] - } - func decidePolicyForNavigationAction(webView: WKWebView, navigationAction: WKNavigationAction) throws -> NavigationActionPolicy { - decidePolicyForNavigationActionArgs = [webViewArg, navigationActionArg] - } - func decidePolicyForNavigationResponse(webView: WKWebView, navigationResponse: WKNavigationResponse) throws -> NavigationResponsePolicy { - decidePolicyForNavigationResponseArgs = [webViewArg, navigationResponseArg] - } - func didFailNavigation(webView: WKWebView, error: NSError) throws { - didFailNavigationArgs = [webViewArg, errorArg] - } - func didFailProvisionalNavigation(webView: WKWebView, error: NSError) throws { - didFailProvisionalNavigationArgs = [webViewArg, errorArg] - } - func webViewWebContentProcessDidTerminate(webView: WKWebView) throws { - webViewWebContentProcessDidTerminateArgs = [webViewArg] - } - func didReceiveAuthenticationChallenge(webView: WKWebView, challenge: URLAuthenticationChallenge) throws -> AuthenticationChallengeResponse { - didReceiveAuthenticationChallengeArgs = [webViewArg, challengeArg] - } -} -*/ - protocol PigeonApiDelegateNSObject { func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject /// Registers the observer object to receive KVO notifications for the key @@ -5942,157 +3979,37 @@ withIdentifier: pigeonIdentifierArg) } } /// Informs the observing object when the value at the specified key path - /// relative to the observed object has changed. - func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.observeValue" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] 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(())) - } - } - } - -} - -/* -// 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 Foundation - - -/// Implementation of `NSObject` that calls to Dart in callback methods. -class ObjectImpl: NSObject { - let api: PigeonApiProtocolNSObject - - init(api: PigeonApiProtocolNSObject) { - self.api = api - } - - func fixMe() { - api.observeValue(pigeonInstance: self, keyPath: keyPath, object: object, change: change) { _ in } - } -} - -/// ProxyApi implementation for `NSObject`. -/// -/// 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 ObjectProxyAPIDelegate : PigeonApiDelegateNSObject { - func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject { - return NSObjectImpl(api: pigeonApi) - } - - func addObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, options: [KeyValueObservingOptions]) throws { - pigeonInstance.addObserver(observer: observer, keyPath: keyPath, options: options) - } - - func removeObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) throws { - pigeonInstance.removeObserver(observer: observer, keyPath: keyPath) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ObjectProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSObject(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testAddObserver() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSObject(registrar) - - let instance = TestObject() - let observer = TestObject - let keyPath = "myString" - let options = [.newValue] - api.pigeonDelegate.addObserver(pigeonApi: api, pigeonInstance: instance, observer: observer, keyPath: keyPath, options: options) - - XCTAssertEqual(instance.addObserverArgs, [observer, keyPath, options]) - } - - func testRemoveObserver() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSObject(registrar) - - let instance = TestObject() - let observer = TestObject - let keyPath = "myString" - api.pigeonDelegate.removeObserver(pigeonApi: api, pigeonInstance: instance, observer: observer, keyPath: keyPath) - - XCTAssertEqual(instance.removeObserverArgs, [observer, keyPath]) - } - - func testObserveValue() { - let api = TestObjectApi() - let instance = ObjectImpl(api: api) - let keyPath = "myString" - let object = TestObject - let change = [.indexes: -1] - instance.observeValue(keyPath: keyPath, object: object, change: change) - - XCTAssertEqual(api.observeValueArgs, [keyPath, object, change]) - } - -} -class TestObject: NSObject { - var addObserverArgs: [AnyHashable?]? = nil - var removeObserverArgs: [AnyHashable?]? = nil - - - override func addObserver() { - addObserverArgs = [observer, keyPath, options] - } - override func removeObserver() { - removeObserverArgs = [observer, keyPath] + /// relative to the observed object has changed. + func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) { + if pigeonRegistrar.ignoreCallsToDart { + completion( + .failure( + PigeonError( + code: "ignore-calls-error", + message: "Calls to Dart are being ignored.", details: ""))) + return + } + let binaryMessenger = pigeonRegistrar.binaryMessenger + let codec = pigeonRegistrar.codec + let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.observeValue" + let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] 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(())) + } + } } -} -class TestObjectApi: PigeonApiProtocolNSObject { - var observeValueArgs: [AnyHashable?]? = nil - func observeValue(keyPath: String?, object: NSObject?, change: [KeyValueChangeKey: Any?]?) throws { - observeValueArgs = [keyPathArg, objectArg, changeArg] - } } -*/ - protocol PigeonApiDelegateUIViewWKWebView { #if !os(macOS) func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView @@ -6626,518 +4543,50 @@ withIdentifier: pigeonIdentifierArg) try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { - reply(wrapError(error)) - } - } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) - } - #endif - } - - #if !os(macOS) - ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) - } - } - } - } - #endif -} - -/* -// 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 Foundation -import UIKit -import WebKit - - -/// ProxyApi implementation for `UIViewWKWebView`. -/// -/// 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 WebViewProxyAPIDelegate : PigeonApiDelegateUIViewWKWebView { - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView { - return UIViewWKWebView(,initialConfiguration: initialConfiguration) - } - - func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: UIViewWKWebView): WKWebViewConfiguration { - return pigeonInstance.configuration - } - - func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: UIViewWKWebView): UIScrollView { - return pigeonInstance.scrollView - } - - func setUIDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws { - pigeonInstance.uIDelegate = delegate: delegate - } - - func setNavigationDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws { - pigeonInstance.navigationDelegate = delegate: delegate - } - - func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.url - } - - func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Double { - return pigeonInstance.estimatedProgress - } - - func load(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws { - pigeonInstance.load(request: request) - } - - func loadHtmlString(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws { - pigeonInstance.loadHtmlString(string: string, baseUrl: baseUrl) - } - - func loadFileUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws { - pigeonInstance.loadFileUrl(url: url, readAccessUrl: readAccessUrl) - } - - func loadFlutterAsset(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws { - pigeonInstance.loadFlutterAsset(key: key) - } - - func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { - return pigeonInstance.canGoBack() - } - - func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { - return pigeonInstance.canGoForward() - } - - func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.goBack() - } - - func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.goForward() - } - - func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.reload() - } - - func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.title - } - - func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { - pigeonInstance.allowsBackForwardNavigationGestures = allow: allow - } - - func setCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws { - pigeonInstance.customUserAgent = userAgent: userAgent - } - - func evaluateJavaScript(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) { - return pigeonInstance.evaluateJavaScript(javaScriptString: javaScriptString) - } - - func setInspectable(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws { - pigeonInstance.inspectable = inspectable: inspectable - } - - func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.customUserAgent - } - - func setAllowsLinkPreview(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { - pigeonInstance.allowsLinkPreview = allow: allow - } - -} -*/ - -/* -// 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 UIKit -import WebKit -import Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebViewProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: TestWebViewConfiguration) - XCTAssertNotNil(instance) - } - - func testConfiguration() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = try? api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.configuration) - } - - func testScrollView() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = try? api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.scrollView) - } - - func testSetUIDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let delegate = TestUIDelegate - api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setUIDelegateArgs, [delegate]) - } - - func testSetNavigationDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let delegate = TestNavigationDelegate - api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setNavigationDelegateArgs, [delegate]) - } - - func testGetUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getUrlCalled) - XCTAssertEqual(value, instance.getUrl()) - } - - func testGetEstimatedProgress() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getEstimatedProgressCalled) - XCTAssertEqual(value, instance.getEstimatedProgress()) - } - - func testLoad() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let request = TestURLRequestWrapper - api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: instance, request: request) - - XCTAssertEqual(instance.loadArgs, [request]) - } - - func testLoadHtmlString() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let string = "myString" - let baseUrl = "myString" - api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: instance, string: string, baseUrl: baseUrl) - - XCTAssertEqual(instance.loadHtmlStringArgs, [string, baseUrl]) - } - - func testLoadFileUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let url = "myString" - let readAccessUrl = "myString" - api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: instance, url: url, readAccessUrl: readAccessUrl) - - XCTAssertEqual(instance.loadFileUrlArgs, [url, readAccessUrl]) - } - - func testLoadFlutterAsset() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let key = "myString" - api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: instance, key: key) - - XCTAssertEqual(instance.loadFlutterAssetArgs, [key]) - } - - func testCanGoBack() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.canGoBackCalled) - XCTAssertEqual(value, instance.canGoBack()) - } - - func testCanGoForward() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.canGoForwardCalled) - XCTAssertEqual(value, instance.canGoForward()) - } - - func testGoBack() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.goBackCalled) - } - - func testGoForward() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.goForwardCalled) - } - - func testReload() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.reloadCalled) - } - - func testGetTitle() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getTitleCalled) - XCTAssertEqual(value, instance.getTitle()) - } - - func testSetAllowsBackForwardNavigationGestures() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let allow = true - api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsBackForwardNavigationGesturesArgs, [allow]) - } - - func testSetCustomUserAgent() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let userAgent = "myString" - api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: instance, userAgent: userAgent) - - XCTAssertEqual(instance.setCustomUserAgentArgs, [userAgent]) - } - - func testEvaluateJavaScript() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let javaScriptString = "myString" - let value = api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: instance, javaScriptString: javaScriptString) - - XCTAssertEqual(instance.evaluateJavaScriptArgs, [javaScriptString]) - XCTAssertEqual(value, instance.evaluateJavaScript(javaScriptString: javaScriptString)) - } - - func testSetInspectable() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let inspectable = true - api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: instance, inspectable: inspectable) - - XCTAssertEqual(instance.setInspectableArgs, [inspectable]) - } - - func testGetCustomUserAgent() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getCustomUserAgentCalled) - XCTAssertEqual(value, instance.getCustomUserAgent()) - } - - func testSetAllowsLinkPreview() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIViewWKWebView(registrar) - - let instance = TestWebView() - let allow = true - api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsLinkPreviewArgs, [allow]) - } - -} -class TestWebView: UIViewWKWebView { - private var configurationTestValue = TestWebViewConfiguration - private var scrollViewTestValue = TestScrollView - var setUIDelegateArgs: [AnyHashable?]? = nil - var setNavigationDelegateArgs: [AnyHashable?]? = nil - var getUrlCalled = false - var getEstimatedProgressCalled = false - var loadArgs: [AnyHashable?]? = nil - var loadHtmlStringArgs: [AnyHashable?]? = nil - var loadFileUrlArgs: [AnyHashable?]? = nil - var loadFlutterAssetArgs: [AnyHashable?]? = nil - var canGoBackCalled = false - var canGoForwardCalled = false - var goBackCalled = false - var goForwardCalled = false - var reloadCalled = false - var getTitleCalled = false - var setAllowsBackForwardNavigationGesturesArgs: [AnyHashable?]? = nil - var setCustomUserAgentArgs: [AnyHashable?]? = nil - var evaluateJavaScriptArgs: [AnyHashable?]? = nil - var setInspectableArgs: [AnyHashable?]? = nil - var getCustomUserAgentCalled = false - var setAllowsLinkPreviewArgs: [AnyHashable?]? = nil - - override var configuration: WKWebViewConfiguration { - return configurationTestValue - } - override var scrollView: UIScrollView { - return scrollViewTestValue - } - - override func setUIDelegate() { - setUIDelegateArgs = [delegate] - } - override func setNavigationDelegate() { - setNavigationDelegateArgs = [delegate] - } - override func getUrl() { - getUrlCalled = true - } - override func getEstimatedProgress() { - getEstimatedProgressCalled = true - } - override func load() { - loadArgs = [request] - } - override func loadHtmlString() { - loadHtmlStringArgs = [string, baseUrl] - } - override func loadFileUrl() { - loadFileUrlArgs = [url, readAccessUrl] - } - override func loadFlutterAsset() { - loadFlutterAssetArgs = [key] - } - override func canGoBack() { - canGoBackCalled = true - } - override func canGoForward() { - canGoForwardCalled = true - } - override func goBack() { - goBackCalled = true - } - override func goForward() { - goForwardCalled = true - } - override func reload() { - reloadCalled = true - } - override func getTitle() { - getTitleCalled = true - } - override func setAllowsBackForwardNavigationGestures() { - setAllowsBackForwardNavigationGesturesArgs = [allow] - } - override func setCustomUserAgent() { - setCustomUserAgentArgs = [userAgent] - } - override func evaluateJavaScript() { - evaluateJavaScriptArgs = [javaScriptString] - return -1 - } - override func setInspectable() { - setInspectableArgs = [inspectable] - } - override func getCustomUserAgent() { - getCustomUserAgentCalled = true + reply(wrapError(error)) + } + } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } + #endif } - override func setAllowsLinkPreview() { - setAllowsLinkPreviewArgs = [allow] + + #if !os(macOS) + ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + } + } + } } + #endif } -*/ - protocol PigeonApiDelegateNSViewWKWebView { #if !os(iOS) func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView @@ -7631,516 +5080,68 @@ withIdentifier: pigeonIdentifierArg) let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { - reply(wrapError(error)) - } - } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) - } - #endif - #if !os(iOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) - } - } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) - } - #endif - } - - #if !os(iOS) - ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) - } - } - } - } - #endif -} - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `NSViewWKWebView`. -/// -/// 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 WebViewProxyAPIDelegate : PigeonApiDelegateNSViewWKWebView { - func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView { - return NSViewWKWebView(,initialConfiguration: initialConfiguration) - } - - func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: NSViewWKWebView): WKWebViewConfiguration { - return pigeonInstance.configuration - } - - func setUIDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws { - pigeonInstance.uIDelegate = delegate: delegate - } - - func setNavigationDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws { - pigeonInstance.navigationDelegate = delegate: delegate - } - - func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.url - } - - func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Double { - return pigeonInstance.estimatedProgress - } - - func load(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws { - pigeonInstance.load(request: request) - } - - func loadHtmlString(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws { - pigeonInstance.loadHtmlString(string: string, baseUrl: baseUrl) - } - - func loadFileUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws { - pigeonInstance.loadFileUrl(url: url, readAccessUrl: readAccessUrl) - } - - func loadFlutterAsset(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws { - pigeonInstance.loadFlutterAsset(key: key) - } - - func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { - return pigeonInstance.canGoBack() - } - - func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool { - return pigeonInstance.canGoForward() - } - - func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.goBack() - } - - func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.goForward() - } - - func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws { - pigeonInstance.reload() - } - - func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.title - } - - func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { - pigeonInstance.allowsBackForwardNavigationGestures = allow: allow - } - - func setCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws { - pigeonInstance.customUserAgent = userAgent: userAgent - } - - func evaluateJavaScript(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) { - return pigeonInstance.evaluateJavaScript(javaScriptString: javaScriptString) - } - - func setInspectable(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws { - pigeonInstance.inspectable = inspectable: inspectable - } - - func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? { - return pigeonInstance.customUserAgent - } - - func setAllowsLinkPreview(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws { - pigeonInstance.allowsLinkPreview = allow: allow - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebViewProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: TestWebViewConfiguration) - XCTAssertNotNil(instance) - } - - func testConfiguration() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = try? api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.configuration) - } - - func testSetUIDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let delegate = TestUIDelegate - api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setUIDelegateArgs, [delegate]) - } - - func testSetNavigationDelegate() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let delegate = TestNavigationDelegate - api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: instance, delegate: delegate) - - XCTAssertEqual(instance.setNavigationDelegateArgs, [delegate]) - } - - func testGetUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getUrlCalled) - XCTAssertEqual(value, instance.getUrl()) - } - - func testGetEstimatedProgress() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getEstimatedProgressCalled) - XCTAssertEqual(value, instance.getEstimatedProgress()) - } - - func testLoad() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let request = TestURLRequestWrapper - api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: instance, request: request) - - XCTAssertEqual(instance.loadArgs, [request]) - } - - func testLoadHtmlString() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let string = "myString" - let baseUrl = "myString" - api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: instance, string: string, baseUrl: baseUrl) - - XCTAssertEqual(instance.loadHtmlStringArgs, [string, baseUrl]) - } - - func testLoadFileUrl() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let url = "myString" - let readAccessUrl = "myString" - api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: instance, url: url, readAccessUrl: readAccessUrl) - - XCTAssertEqual(instance.loadFileUrlArgs, [url, readAccessUrl]) - } - - func testLoadFlutterAsset() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let key = "myString" - api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: instance, key: key) - - XCTAssertEqual(instance.loadFlutterAssetArgs, [key]) - } - - func testCanGoBack() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.canGoBackCalled) - XCTAssertEqual(value, instance.canGoBack()) - } - - func testCanGoForward() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.canGoForwardCalled) - XCTAssertEqual(value, instance.canGoForward()) - } - - func testGoBack() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.goBackCalled) - } - - func testGoForward() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.goForwardCalled) - } - - func testReload() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.reloadCalled) - } - - func testGetTitle() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getTitleCalled) - XCTAssertEqual(value, instance.getTitle()) - } - - func testSetAllowsBackForwardNavigationGestures() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let allow = true - api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsBackForwardNavigationGesturesArgs, [allow]) - } - - func testSetCustomUserAgent() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let userAgent = "myString" - api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: instance, userAgent: userAgent) - - XCTAssertEqual(instance.setCustomUserAgentArgs, [userAgent]) - } - - func testEvaluateJavaScript() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let javaScriptString = "myString" - let value = api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: instance, javaScriptString: javaScriptString) - - XCTAssertEqual(instance.evaluateJavaScriptArgs, [javaScriptString]) - XCTAssertEqual(value, instance.evaluateJavaScript(javaScriptString: javaScriptString)) - } - - func testSetInspectable() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let inspectable = true - api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: instance, inspectable: inspectable) - - XCTAssertEqual(instance.setInspectableArgs, [inspectable]) - } - - func testGetCustomUserAgent() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let value = api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getCustomUserAgentCalled) - XCTAssertEqual(value, instance.getCustomUserAgent()) - } - - func testSetAllowsLinkPreview() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiNSViewWKWebView(registrar) - - let instance = TestWebView() - let allow = true - api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsLinkPreviewArgs, [allow]) - } - -} -class TestWebView: NSViewWKWebView { - private var configurationTestValue = TestWebViewConfiguration - var setUIDelegateArgs: [AnyHashable?]? = nil - var setNavigationDelegateArgs: [AnyHashable?]? = nil - var getUrlCalled = false - var getEstimatedProgressCalled = false - var loadArgs: [AnyHashable?]? = nil - var loadHtmlStringArgs: [AnyHashable?]? = nil - var loadFileUrlArgs: [AnyHashable?]? = nil - var loadFlutterAssetArgs: [AnyHashable?]? = nil - var canGoBackCalled = false - var canGoForwardCalled = false - var goBackCalled = false - var goForwardCalled = false - var reloadCalled = false - var getTitleCalled = false - var setAllowsBackForwardNavigationGesturesArgs: [AnyHashable?]? = nil - var setCustomUserAgentArgs: [AnyHashable?]? = nil - var evaluateJavaScriptArgs: [AnyHashable?]? = nil - var setInspectableArgs: [AnyHashable?]? = nil - var getCustomUserAgentCalled = false - var setAllowsLinkPreviewArgs: [AnyHashable?]? = nil - - override var configuration: WKWebViewConfiguration { - return configurationTestValue + reply(wrapError(error)) + } + } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) + } + #endif + #if !os(iOS) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } + } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) + } + #endif } - override func setUIDelegate() { - setUIDelegateArgs = [delegate] - } - override func setNavigationDelegate() { - setNavigationDelegateArgs = [delegate] - } - override func getUrl() { - getUrlCalled = true - } - override func getEstimatedProgress() { - getEstimatedProgressCalled = true - } - override func load() { - loadArgs = [request] - } - override func loadHtmlString() { - loadHtmlStringArgs = [string, baseUrl] - } - override func loadFileUrl() { - loadFileUrlArgs = [url, readAccessUrl] - } - override func loadFlutterAsset() { - loadFlutterAssetArgs = [key] - } - override func canGoBack() { - canGoBackCalled = true - } - override func canGoForward() { - canGoForwardCalled = true - } - override func goBack() { - goBackCalled = true - } - override func goForward() { - goForwardCalled = true - } - override func reload() { - reloadCalled = true - } - override func getTitle() { - getTitleCalled = true - } - override func setAllowsBackForwardNavigationGestures() { - setAllowsBackForwardNavigationGesturesArgs = [allow] - } - override func setCustomUserAgent() { - setCustomUserAgentArgs = [userAgent] - } - override func evaluateJavaScript() { - evaluateJavaScriptArgs = [javaScriptString] - return -1 - } - override func setInspectable() { - setInspectableArgs = [inspectable] - } - override func getCustomUserAgent() { - getCustomUserAgentCalled = true - } - override func setAllowsLinkPreview() { - setAllowsLinkPreviewArgs = [allow] + #if !os(iOS) + ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + } + } + } } + #endif } -*/ - open class PigeonApiDelegateWKWebView { } @@ -8424,159 +5425,6 @@ withIdentifier: pigeonIdentifierArg) } } - -/* -// 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 Foundation -import WebKit - -/// Implementation of `WKUIDelegate` that calls to Dart in callback methods. -class UIDelegateImpl: WKUIDelegate { - let api: PigeonApiProtocolWKUIDelegate - - init(api: PigeonApiProtocolWKUIDelegate) { - self.api = api - } - - func fixMe() { - api.onCreateWebView(pigeonInstance: self, webView: webView, configuration: configuration, navigationAction: navigationAction) { _ in } - } - - func fixMe() { - api.requestMediaCapturePermission(pigeonInstance: self, webView: webView, origin: origin, frame: frame, type: type) { _ in } - } - - func fixMe() { - api.runJavaScriptAlertPanel(pigeonInstance: self, webView: webView, message: message, frame: frame) { _ in } - } - - func fixMe() { - api.runJavaScriptConfirmPanel(pigeonInstance: self, webView: webView, message: message, frame: frame) { _ in } - } - - func fixMe() { - api.runJavaScriptTextInputPanel(pigeonInstance: self, webView: webView, prompt: prompt, defaultText: defaultText, frame: frame) { _ in } - } -} - -/// ProxyApi implementation for `WKUIDelegate`. -/// -/// 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 UIDelegateProxyAPIDelegate : PigeonApiDelegateWKUIDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUIDelegate) throws -> WKUIDelegate { - return WKUIDelegateImpl(api: pigeonApi) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class UIDelegateProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKUIDelegate(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testOnCreateWebView() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let configuration = TestWebViewConfiguration - let navigationAction = TestNavigationAction - instance.onCreateWebView(webView: webView, configuration: configuration, navigationAction: navigationAction) - - XCTAssertEqual(api.onCreateWebViewArgs, [webView, configuration, navigationAction]) - } - - func testRequestMediaCapturePermission() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let origin = TestSecurityOrigin - let frame = TestFrameInfo - let type = .camera - instance.requestMediaCapturePermission(webView: webView, origin: origin, frame: frame, type: type) - - XCTAssertEqual(api.requestMediaCapturePermissionArgs, [webView, origin, frame, type]) - } - - func testRunJavaScriptAlertPanel() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let message = "myString" - let frame = TestFrameInfo - instance.runJavaScriptAlertPanel(webView: webView, message: message, frame: frame) - - XCTAssertEqual(api.runJavaScriptAlertPanelArgs, [webView, message, frame]) - } - - func testRunJavaScriptConfirmPanel() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let message = "myString" - let frame = TestFrameInfo - instance.runJavaScriptConfirmPanel(webView: webView, message: message, frame: frame) - - XCTAssertEqual(api.runJavaScriptConfirmPanelArgs, [webView, message, frame]) - } - - func testRunJavaScriptTextInputPanel() { - let api = TestUIDelegateApi() - let instance = UIDelegateImpl(api: api) - let webView = TestWebView - let prompt = "myString" - let defaultText = "myString" - let frame = TestFrameInfo - instance.runJavaScriptTextInputPanel(webView: webView, prompt: prompt, defaultText: defaultText, frame: frame) - - XCTAssertEqual(api.runJavaScriptTextInputPanelArgs, [webView, prompt, defaultText, frame]) - } - -} -class TestUIDelegateApi: PigeonApiProtocolWKUIDelegate { - var onCreateWebViewArgs: [AnyHashable?]? = nil - var requestMediaCapturePermissionArgs: [AnyHashable?]? = nil - var runJavaScriptAlertPanelArgs: [AnyHashable?]? = nil - var runJavaScriptConfirmPanelArgs: [AnyHashable?]? = nil - var runJavaScriptTextInputPanelArgs: [AnyHashable?]? = nil - - func onCreateWebView(webView: WKWebView, configuration: WKWebViewConfiguration, navigationAction: WKNavigationAction) throws { - onCreateWebViewArgs = [webViewArg, configurationArg, navigationActionArg] - } - func requestMediaCapturePermission(webView: WKWebView, origin: WKSecurityOrigin, frame: WKFrameInfo, type: MediaCaptureType) throws -> PermissionDecision { - requestMediaCapturePermissionArgs = [webViewArg, originArg, frameArg, typeArg] - } - func runJavaScriptAlertPanel(webView: WKWebView, message: String, frame: WKFrameInfo) throws { - runJavaScriptAlertPanelArgs = [webViewArg, messageArg, frameArg] - } - func runJavaScriptConfirmPanel(webView: WKWebView, message: String, frame: WKFrameInfo) throws -> Bool { - runJavaScriptConfirmPanelArgs = [webViewArg, messageArg, frameArg] - } - func runJavaScriptTextInputPanel(webView: WKWebView, prompt: String, defaultText: String?, frame: WKFrameInfo) throws -> String? { - runJavaScriptTextInputPanelArgs = [webViewArg, promptArg, defaultTextArg, frameArg] - } -} -*/ - protocol PigeonApiDelegateWKHTTPCookieStore { /// Sets a cookie policy that indicates whether the cookie store allows cookie /// storage. @@ -8657,62 +5505,6 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } } } - -/* -// 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 Foundation -import WebKit - - -/// ProxyApi implementation for `WKHTTPCookieStore`. -/// -/// 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 HTTPCookieStoreProxyAPIDelegate : PigeonApiDelegateWKHTTPCookieStore { - func setCookie(pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, completion: @escaping (Result) -> Void) { - pigeonInstance.cookie = cookie: cookie - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class HTTPCookieStoreProxyAPITests: XCTestCase { - func testSetCookie() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKHTTPCookieStore(registrar) - - let instance = TestHTTPCookieStore() - let cookie = TestHTTPCookie - api.pigeonDelegate.setCookie(pigeonApi: api, pigeonInstance: instance, cookie: cookie) - - XCTAssertEqual(instance.setCookieArgs, [cookie]) - } - -} -class TestHTTPCookieStore: WKHTTPCookieStore { - var setCookieArgs: [AnyHashable?]? = nil - - - override func setCookie() { - setCookieArgs = [cookie] - } -} -*/ - protocol PigeonApiDelegateUIScrollViewDelegate { #if !os(macOS) func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate @@ -8840,81 +5632,6 @@ withIdentifier: pigeonIdentifierArg) #endif } - -/* -// 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 Foundation -import UIKit - -/// Implementation of `UIScrollViewDelegate` that calls to Dart in callback methods. -class ScrollViewDelegateImpl: UIScrollViewDelegate { - let api: PigeonApiProtocolUIScrollViewDelegate - - init(api: PigeonApiProtocolUIScrollViewDelegate) { - self.api = api - } - - func fixMe() { - api.scrollViewDidScroll(pigeonInstance: self, scrollView: scrollView, x: x, y: y) { _ in } - } -} - -/// ProxyApi implementation for `UIScrollViewDelegate`. -/// -/// 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 ScrollViewDelegateProxyAPIDelegate : PigeonApiDelegateUIScrollViewDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate { - return UIScrollViewDelegateImpl(api: pigeonApi) - } - -} -*/ - -/* -// 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 UIKit -import Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class ScrollViewDelegateProxyAPITests: XCTestCase { - func testPigeonDefaultConstructor() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiUIScrollViewDelegate(registrar) - - let instance = try? api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api ) - XCTAssertNotNil(instance) - } - - func testScrollViewDidScroll() { - let api = TestScrollViewDelegateApi() - let instance = ScrollViewDelegateImpl(api: api) - let scrollView = TestScrollView - let x = 1.0 - let y = 1.0 - instance.scrollViewDidScroll(scrollView: scrollView, x: x, y: y) - - XCTAssertEqual(api.scrollViewDidScrollArgs, [scrollView, x, y]) - } - -} -class TestScrollViewDelegateApi: PigeonApiProtocolUIScrollViewDelegate { - var scrollViewDidScrollArgs: [AnyHashable?]? = nil - - func scrollViewDidScroll(scrollView: UIScrollView, x: Double, y: Double) throws { - scrollViewDidScrollArgs = [scrollViewArg, xArg, yArg] - } -} -*/ - protocol PigeonApiDelegateURLCredential { /// Creates a URL credential instance for internet password authentication /// with a given user name and password, using a given persistence setting. @@ -9024,82 +5741,29 @@ withIdentifier: pigeonIdentifierArg) 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.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(())) - } - } - } - } -} - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URLCredential`. -/// -/// 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 URLCredentialProxyAPIDelegate : PigeonApiDelegateURLCredential { - func withUser(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence) throws -> URLCredential { - return URLCredential(,user: user, password: password, persistence: persistence) - } - - func withUserAsync(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence, completion: @escaping (Result) -> Void) { - return URLCredential.withUserAsync(user: user, password: password, persistence: persistence) - } - - func serverTrustAsync(pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) { - return URLCredential.serverTrustAsync(trust: trust) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLCredentialProxyAPITests: XCTestCase { - func testWithUser() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLCredential(registrar) - - let instance = try? api.pigeonDelegate.withUser(pigeonApi: api, user: "myString", password: "myString", persistence: .none) - XCTAssertNotNil(instance) + } 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(())) + } + } + } } - } -*/ - protocol PigeonApiDelegateURLProtectionSpace { /// The receiver’s host. func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String @@ -9188,134 +5852,6 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URLProtectionSpace`. -/// -/// 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 URLProtectionSpaceProxyAPIDelegate : PigeonApiDelegateURLProtectionSpace { - func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String { - return pigeonInstance.host - } - - func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> Int64 { - return pigeonInstance.port - } - - func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? { - return pigeonInstance.realm - } - - func authenticationMethod(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? { - return pigeonInstance.authenticationMethod - } - - func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> SecTrustWrapper? { - return pigeonInstance.serverTrust - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLProtectionSpaceProxyAPITests: XCTestCase { - func testHost() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = try? api.pigeonDelegate.host(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.host) - } - - func testPort() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = try? api.pigeonDelegate.port(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.port) - } - - func testRealm() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = try? api.pigeonDelegate.realm(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.realm) - } - - func testAuthenticationMethod() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = try? api.pigeonDelegate.authenticationMethod(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.authenticationMethod) - } - - func testGetServerTrust() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLProtectionSpace(registrar) - - let instance = TestURLProtectionSpace() - let value = api.pigeonDelegate.getServerTrust(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getServerTrustCalled) - XCTAssertEqual(value, instance.getServerTrust()) - } - -} -class TestURLProtectionSpace: URLProtectionSpace { - private var hostTestValue = "myString" - private var portTestValue = 0 - private var realmTestValue = "myString" - private var authenticationMethodTestValue = "myString" - var getServerTrustCalled = false - - override var host: String { - return hostTestValue - } - override var port: Int64 { - return portTestValue - } - override var realm: String { - return realmTestValue - } - override var authenticationMethod: String { - return authenticationMethodTestValue - } - - override func getServerTrust() { - getServerTrustCalled = true - } -} -*/ - protocol PigeonApiDelegateURLAuthenticationChallenge { /// The receiver’s protection space. func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace @@ -9392,62 +5928,6 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URLAuthenticationChallenge`. -/// -/// 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 URLAuthenticationChallengeProxyAPIDelegate : PigeonApiDelegateURLAuthenticationChallenge { - func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace { - return pigeonInstance.protectionSpace - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLAuthenticationChallengeProxyAPITests: XCTestCase { - func testGetProtectionSpace() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURLAuthenticationChallenge(registrar) - - let instance = TestURLAuthenticationChallenge() - let value = api.pigeonDelegate.getProtectionSpace(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getProtectionSpaceCalled) - XCTAssertEqual(value, instance.getProtectionSpace()) - } - -} -class TestURLAuthenticationChallenge: URLAuthenticationChallenge { - var getProtectionSpaceCalled = false - - - override func getProtectionSpace() { - getProtectionSpaceCalled = true - } -} -*/ - protocol PigeonApiDelegateURL { /// The absolute string for the URL. func getAbsoluteString(pigeonApi: PigeonApiURL, pigeonInstance: URL) throws -> String @@ -9524,62 +6004,6 @@ final class PigeonApiURL: PigeonApiProtocolURL { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `URL`. -/// -/// 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 URLProxyAPIDelegate : PigeonApiDelegateURL { - func getAbsoluteString(pigeonApi: PigeonApiURL, pigeonInstance: URL) throws -> String { - return pigeonInstance.absoluteString - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class URLProxyAPITests: XCTestCase { - func testGetAbsoluteString() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiURL(registrar) - - let instance = TestURL() - let value = api.pigeonDelegate.getAbsoluteString(pigeonApi: api, pigeonInstance: instance ) - - XCTAssertTrue(instance.getAbsoluteStringCalled) - XCTAssertEqual(value, instance.getAbsoluteString()) - } - -} -class TestURL: URL { - var getAbsoluteStringCalled = false - - - override func getAbsoluteString() { - getAbsoluteStringCalled = true - } -} -*/ - protocol PigeonApiDelegateWKWebpagePreferences { /// A Boolean value that indicates whether JavaScript from web content is /// allowed to run. @@ -9676,62 +6100,6 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } } } - -/* -// 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 Foundation -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 { - func setAllowsContentJavaScript(pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) throws { - pigeonInstance.allowsContentJavaScript = allow: allow - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class WebpagePreferencesProxyAPITests: XCTestCase { - func testSetAllowsContentJavaScript() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiWKWebpagePreferences(registrar) - - let instance = TestWebpagePreferences() - let allow = true - api.pigeonDelegate.setAllowsContentJavaScript(pigeonApi: api, pigeonInstance: instance, allow: allow) - - XCTAssertEqual(instance.setAllowsContentJavaScriptArgs, [allow]) - } - -} -class TestWebpagePreferences: WKWebpagePreferences { - var setAllowsContentJavaScriptArgs: [AnyHashable?]? = nil - - - override func setAllowsContentJavaScript() { - setAllowsContentJavaScriptArgs = [allow] - } -} -*/ - protocol PigeonApiDelegateGetTrustResultResponse { /// The result code from the most recent trust evaluation. func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType @@ -9791,86 +6159,6 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `GetTrustResultResponse`. -/// -/// 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 GetTrustResultResponseProxyAPIDelegate : PigeonApiDelegateGetTrustResultResponse { - func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType { - switch pigeonInstance.result { - case .unspecified: - return .unspecified - case .proceed: - return .proceed - case .deny: - return .deny - case .recoverableTrustFailure: - return .recoverableTrustFailure - case .fatalTrustFailure: - return .fatalTrustFailure - case .otherError: - return .otherError - case .invalid: - return .invalid - case .confirm: - return .confirm - @unknown default: - return .unknown - } - } - - func resultCode(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> Int64 { - return pigeonInstance.resultCode - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class GetTrustResultResponseProxyAPITests: XCTestCase { - func testResult() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiGetTrustResultResponse(registrar) - - let instance = TestGetTrustResultResponse() - let value = try? api.pigeonDelegate.result(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.result) - } - - func testResultCode() { - let registrar = TestProxyApiRegistrar() - let api = registrar.apiDelegate.pigeonApiGetTrustResultResponse(registrar) - - let instance = TestGetTrustResultResponse() - let value = try? api.pigeonDelegate.resultCode(pigeonApi: api, pigeonInstance: instance) - - XCTAssertEqual(value, instance.resultCode) - } - -} -*/ - protocol PigeonApiDelegateSecTrust { /// Evaluates trust for the specified certificate and policies. func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) @@ -10020,59 +6308,6 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `SecTrust`. -/// -/// 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 SecTrustWrapperProxyAPIDelegate : PigeonApiDelegateSecTrust { - func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) { - return SecTrust.evaluateWithError(trust: trust) - } - - func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> FlutterStandardTypedData? { - return SecTrust.copyExceptions(trust: trust) - } - - func setExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData?) throws -> Bool { - return SecTrust.setExceptions(trust: trust, exceptions: exceptions) - } - - func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> GetTrustResultResponse { - return SecTrust.getTrustResult(trust: trust) - } - - func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> [SecCertificateWrapper]? { - return SecTrust.copyCertificateChain(trust: trust) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class SecTrustWrapperProxyAPITests: XCTestCase { -} -*/ - protocol PigeonApiDelegateSecCertificate { /// Returns a DER representation of a certificate given a certificate object. func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData @@ -10149,40 +6384,3 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { } } } - -/* -// 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 Foundation - - - -/// ProxyApi implementation for `SecCertificate`. -/// -/// 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 SecCertificateWrapperProxyAPIDelegate : PigeonApiDelegateSecCertificate { - func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData { - return SecCertificate.copyData(certificate: certificate) - } - -} -*/ - -/* -// 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 Flutter -import XCTest - -@testable import webview_flutter_wkwebview - -class SecCertificateWrapperProxyAPITests: XCTestCase { -} -*/ - diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart index 63f48d86f195..206afc5d5c97 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart @@ -202,7 +202,7 @@ Page resource error: }) ..setOnSSlAuthError((PlatformSslAuthError error) { debugPrint('SSL error from ${(error as WebKitSslAuthError).host}'); - error.proceed(); + error.cancel(); }), ) ..addJavaScriptChannel(JavaScriptChannelParams( @@ -479,7 +479,7 @@ class SampleMenu extends StatelessWidget { Future _loadFlutterDev() { return webViewController.loadRequest(LoadRequestParams( - uri: Uri.parse('https://expired.badssl.com/'), + uri: Uri.parse('https://flutter.dev'), )); } 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 991a6d6a2860..9237f07e6be2 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 @@ -421,298 +421,6 @@ class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { } } -/// Handles constructing objects and calling static methods for the Android -/// Interactive Media Ads native library. -/// -/// This class provides dependency injection for the implementations of the -/// platform interface classes. Improving the ease of unit testing and/or -/// overriding the underlying Android classes. -/// -/// By default each function calls the default constructor of the class it -/// intends to return. -class WebKitGProxy { - /// Constructs an [WebKitGProxy]. - const WebKitGProxy({ - this.newURLRequest = URLRequest.new, - this.newWKUserScript = WKUserScript.new, - this.newHTTPCookie = HTTPCookie.new, - this.newAuthenticationChallengeResponse = - AuthenticationChallengeResponse.new, - this.newWKWebViewConfiguration = WKWebViewConfiguration.new, - this.newWKScriptMessageHandler = WKScriptMessageHandler.new, - this.newWKNavigationDelegate = WKNavigationDelegate.new, - this.newNSObject = NSObject.new, - this.newUIViewWKWebView = UIViewWKWebView.new, - this.newNSViewWKWebView = NSViewWKWebView.new, - this.newWKUIDelegate = WKUIDelegate.new, - this.newUIScrollViewDelegate = UIScrollViewDelegate.new, - this.withUserURLCredential = URLCredential.withUser, - this.createAsyncAuthenticationChallengeResponse = - AuthenticationChallengeResponse.createAsync, - this.withUserAsyncURLCredential = URLCredential.withUserAsync, - this.serverTrustAsyncURLCredential = URLCredential.serverTrustAsync, - this.evaluateWithErrorSecTrust = SecTrust.evaluateWithError, - this.copyExceptionsSecTrust = SecTrust.copyExceptions, - this.setExceptionsSecTrust = SecTrust.setExceptions, - this.getTrustResultSecTrust = SecTrust.getTrustResult, - this.copyCertificateChainSecTrust = SecTrust.copyCertificateChain, - this.copyDataSecCertificate = SecCertificate.copyData, - this.defaultDataStoreWKWebsiteDataStore = - _defaultDataStoreWKWebsiteDataStore, - }); - - /// Constructs [URLRequest]. - final URLRequest Function({ - required String url, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newURLRequest; - - /// Constructs [WKUserScript]. - final WKUserScript Function({ - required String source, - required UserScriptInjectionTime injectionTime, - required bool isForMainFrameOnly, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKUserScript; - - /// Constructs [HTTPCookie]. - final HTTPCookie Function({ - required Map properties, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newHTTPCookie; - - /// Constructs [AuthenticationChallengeResponse]. - final AuthenticationChallengeResponse Function({ - required UrlSessionAuthChallengeDisposition disposition, - URLCredential? credential, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newAuthenticationChallengeResponse; - - /// Constructs [WKWebViewConfiguration]. - final WKWebViewConfiguration Function({ - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKWebViewConfiguration; - - /// Constructs [WKScriptMessageHandler]. - final WKScriptMessageHandler Function({ - required void Function( - WKScriptMessageHandler, - WKUserContentController, - WKScriptMessage, - ) didReceiveScriptMessage, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKScriptMessageHandler; - - /// Constructs [WKNavigationDelegate]. - final WKNavigationDelegate Function({ - required Future Function( - WKNavigationDelegate, - WKWebView, - WKNavigationAction, - ) decidePolicyForNavigationAction, - required Future Function( - WKNavigationDelegate, - WKWebView, - WKNavigationResponse, - ) decidePolicyForNavigationResponse, - required Future Function( - WKNavigationDelegate, - WKWebView, - URLAuthenticationChallenge, - ) didReceiveAuthenticationChallenge, - void Function( - WKNavigationDelegate, - WKWebView, - String?, - )? didFinishNavigation, - void Function( - WKNavigationDelegate, - WKWebView, - String?, - )? didStartProvisionalNavigation, - void Function( - WKNavigationDelegate, - WKWebView, - NSError, - )? didFailNavigation, - void Function( - WKNavigationDelegate, - WKWebView, - NSError, - )? didFailProvisionalNavigation, - void Function( - WKNavigationDelegate, - WKWebView, - )? webViewWebContentProcessDidTerminate, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKNavigationDelegate; - - /// Constructs [NSObject]. - final NSObject Function({ - void Function( - NSObject, - String?, - NSObject?, - Map?, - )? observeValue, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newNSObject; - - /// Constructs [UIViewWKWebView]. - final UIViewWKWebView Function({ - required WKWebViewConfiguration initialConfiguration, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newUIViewWKWebView; - - /// Constructs [NSViewWKWebView]. - final NSViewWKWebView Function({ - required WKWebViewConfiguration initialConfiguration, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newNSViewWKWebView; - - /// Constructs [WKUIDelegate]. - final WKUIDelegate Function({ - required Future Function( - WKUIDelegate, - WKWebView, - WKSecurityOrigin, - WKFrameInfo, - MediaCaptureType, - ) requestMediaCapturePermission, - required Future Function( - WKUIDelegate, - WKWebView, - String, - WKFrameInfo, - ) runJavaScriptConfirmPanel, - void Function( - WKUIDelegate, - WKWebView, - WKWebViewConfiguration, - WKNavigationAction, - )? onCreateWebView, - Future Function( - WKUIDelegate, - WKWebView, - String, - WKFrameInfo, - )? runJavaScriptAlertPanel, - Future Function( - WKUIDelegate, - WKWebView, - String, - String?, - WKFrameInfo, - )? runJavaScriptTextInputPanel, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newWKUIDelegate; - - /// Constructs [UIScrollViewDelegate]. - final UIScrollViewDelegate Function({ - void Function( - UIScrollViewDelegate, - UIScrollView, - double, - double, - )? scrollViewDidScroll, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) newUIScrollViewDelegate; - - /// Constructs [URLCredential]. - final URLCredential Function({ - required String user, - required String password, - required UrlCredentialPersistence persistence, - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) withUserURLCredential; - - /// Calls to [AuthenticationChallengeResponse.createAsync]. - final Future Function( - UrlSessionAuthChallengeDisposition, - URLCredential?, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) createAsyncAuthenticationChallengeResponse; - - /// Calls to [URLCredential.withUserAsync]. - final Future Function( - String, - String, - UrlCredentialPersistence, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) withUserAsyncURLCredential; - - /// Calls to [URLCredential.serverTrustAsync]. - final Future Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) serverTrustAsyncURLCredential; - - /// Calls to [SecTrust.evaluateWithError]. - final Future Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) evaluateWithErrorSecTrust; - - /// Calls to [SecTrust.copyExceptions]. - final Future Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) copyExceptionsSecTrust; - - /// Calls to [SecTrust.setExceptions]. - final Future Function( - SecTrust, - Uint8List?, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) setExceptionsSecTrust; - - /// Calls to [SecTrust.getTrustResult]. - final Future Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) getTrustResultSecTrust; - - /// Calls to [SecTrust.copyCertificateChain]. - final Future?> Function( - SecTrust, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) copyCertificateChainSecTrust; - - /// Calls to [SecCertificate.copyData]. - final Future Function( - SecCertificate, { - BinaryMessenger? pigeon_binaryMessenger, - PigeonInstanceManager? pigeon_instanceManager, - }) copyDataSecCertificate; - - /// Calls to [WKWebsiteDataStore.defaultDataStore]. - final WKWebsiteDataStore Function() defaultDataStoreWKWebsiteDataStore; - - static WKWebsiteDataStore _defaultDataStoreWKWebsiteDataStore() => - WKWebsiteDataStore.defaultDataStore; -} - /// The values that can be returned in a change dictionary. /// @@ -2517,6 +2225,10 @@ class HTTPCookie extends NSObject { /// `WKNavigationDelegate` responds with a completion handler that takes two /// values. The wrapper returns this class instead to handle this scenario. class AuthenticationChallengeResponse extends PigeonInternalProxyApiBaseClass { + /// Creates an [AuthenticationChallengeResponse]. + /// + /// Due to https://github.com/flutter/flutter/issues/162437, this should only + /// be used for testing. AuthenticationChallengeResponse({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index a33942e65fab..9cfd5751c6cc 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -33,11 +33,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: - git: - url: git@github.com:bparrishMines/packages.git - ref: pigeon_helper - path: packages/pigeon + pigeon: ^25.3.1 topics: - html From 28e7bb7fb244e525c5fbbd53d8c177c1b92eca92 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:47:01 -0400 Subject: [PATCH 30/34] formatting --- ...ionChallengeResponseProxyAPIDelegate.swift | 13 +- .../URLCredentialProxyAPIDelegate.swift | 20 +- .../WebKitLibrary.g.swift | 4918 ++++++++++------- .../lib/src/common/web_kit.g.dart | 322 +- 4 files changed, 3278 insertions(+), 1995 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift index a820fa7f6922..e90e137cddc5 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift @@ -33,9 +33,16 @@ class AuthenticationChallengeResponseProxyAPIDelegate: return AuthenticationChallengeResponse(disposition: nativeDisposition, credential: credential) } - - func createAsync(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, completion: @escaping (Result) -> Void) { - completion(Result.success(try! pigeonDefaultConstructor(pigeonApi: pigeonApi, disposition: disposition, credential: credential))) + + func createAsync( + pigeonApi: PigeonApiAuthenticationChallengeResponse, + disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, + completion: @escaping (Result) -> Void + ) { + completion( + Result.success( + try! pigeonDefaultConstructor( + pigeonApi: pigeonApi, disposition: disposition, credential: credential))) } func disposition( diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift index 1f85b96adbf9..3e117a24e56a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift @@ -26,12 +26,22 @@ class URLCredentialProxyAPIDelegate: PigeonApiDelegateURLCredential { } return URLCredential(user: user, password: password, persistence: nativePersistence) } - - func withUserAsync(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence, completion: @escaping (Result) -> Void) { - completion(Result.success(try! withUser(pigeonApi: pigeonApi, user: user, password: password, persistence: persistence))) + + func withUserAsync( + pigeonApi: PigeonApiURLCredential, user: String, password: String, + persistence: UrlCredentialPersistence, + completion: @escaping (Result) -> Void + ) { + completion( + Result.success( + try! withUser( + pigeonApi: pigeonApi, user: user, password: password, persistence: persistence))) } - - func serverTrustAsync(pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) { + + func serverTrustAsync( + pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, + completion: @escaping (Result) -> Void + ) { completion(Result.success(URLCredential(trust: trust.value))) } } 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 6f8403c392c3..dd0c8855254c 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 @@ -6,8 +6,9 @@ import Foundation import WebKit + #if !os(macOS) -import UIKit + import UIKit #endif #if os(iOS) @@ -63,7 +64,9 @@ private func wrapError(_ error: Any) -> [Any?] { } private func createConnectionError(withChannelName channelName: String) -> PigeonError { - return PigeonError(code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", details: "") + return PigeonError( + code: "channel-error", message: "Unable to establish connection on channel: '\(channelName)'.", + details: "") } private func isNullish(_ value: Any?) -> Bool { @@ -81,7 +84,6 @@ protocol WebKitLibraryPigeonInternalFinalizerDelegate: AnyObject { func onDeinit(identifier: Int64) } - // Attaches to an object to receive a callback when the object is deallocated. internal final class WebKitLibraryPigeonInternalFinalizer { private static let associatedObjectKey = malloc(1)! @@ -97,7 +99,8 @@ internal final class WebKitLibraryPigeonInternalFinalizer { } internal static func attach( - to instance: AnyObject, identifier: Int64, delegate: WebKitLibraryPigeonInternalFinalizerDelegate + to instance: AnyObject, identifier: Int64, + delegate: WebKitLibraryPigeonInternalFinalizerDelegate ) { let finalizer = WebKitLibraryPigeonInternalFinalizer(identifier: identifier, delegate: delegate) objc_setAssociatedObject(instance, associatedObjectKey, finalizer, .OBJC_ASSOCIATION_RETAIN) @@ -112,7 +115,6 @@ internal final class WebKitLibraryPigeonInternalFinalizer { } } - /// Maintains instances used to communicate with the corresponding objects in Dart. /// /// Objects stored in this container are represented by an object in Dart that is also stored in @@ -216,7 +218,8 @@ final class WebKitLibraryPigeonInstanceManager { identifiers.setObject(NSNumber(value: identifier), forKey: instance) weakInstances.setObject(instance, forKey: NSNumber(value: identifier)) strongInstances.setObject(instance, forKey: NSNumber(value: identifier)) - WebKitLibraryPigeonInternalFinalizer.attach(to: instance, identifier: identifier, delegate: finalizerDelegate) + WebKitLibraryPigeonInternalFinalizer.attach( + to: instance, identifier: identifier, delegate: finalizerDelegate) } /// Retrieves the identifier paired with an instance. @@ -293,7 +296,6 @@ final class WebKitLibraryPigeonInstanceManager { } } - private class WebKitLibraryPigeonInstanceManagerApi { /// The codec used for serializing messages. var codec: FlutterStandardMessageCodec { WebKitLibraryPigeonCodec.shared } @@ -306,9 +308,14 @@ private class WebKitLibraryPigeonInstanceManagerApi { } /// Sets up an instance of `WebKitLibraryPigeonInstanceManagerApi` to handle messages through the `binaryMessenger`. - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, instanceManager: WebKitLibraryPigeonInstanceManager?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, instanceManager: WebKitLibraryPigeonInstanceManager? + ) { let codec = WebKitLibraryPigeonCodec.shared - let removeStrongReferenceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference", binaryMessenger: binaryMessenger, codec: codec) + let removeStrongReferenceChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference", + binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { removeStrongReferenceChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -323,7 +330,9 @@ private class WebKitLibraryPigeonInstanceManagerApi { } else { removeStrongReferenceChannel.setMessageHandler(nil) } - let clearChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.clear", binaryMessenger: binaryMessenger, codec: codec) + let clearChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.clear", + binaryMessenger: binaryMessenger, codec: codec) if let instanceManager = instanceManager { clearChannel.setMessageHandler { _, reply in do { @@ -339,9 +348,13 @@ private class WebKitLibraryPigeonInstanceManagerApi { } /// Sends a message to the Dart `InstanceManager` to remove the strong reference of the instance associated with `identifier`. - func removeStrongReference(identifier identifierArg: Int64, completion: @escaping (Result) -> Void) { - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + func removeStrongReference( + identifier identifierArg: Int64, completion: @escaping (Result) -> Void + ) { + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.PigeonInternalInstanceManager.removeStrongReference" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([identifierArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -364,111 +377,141 @@ protocol WebKitLibraryPigeonProxyApiDelegate { func pigeonApiURLRequest(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLRequest /// An implementation of [PigeonApiHTTPURLResponse] used to add a new Dart instance of /// `HTTPURLResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiHTTPURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiHTTPURLResponse + func pigeonApiHTTPURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiHTTPURLResponse /// An implementation of [PigeonApiURLResponse] used to add a new Dart instance of /// `URLResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLResponse + func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLResponse /// An implementation of [PigeonApiWKUserScript] used to add a new Dart instance of /// `WKUserScript` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUserScript(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUserScript + func pigeonApiWKUserScript(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKUserScript /// An implementation of [PigeonApiWKNavigationAction] used to add a new Dart instance of /// `WKNavigationAction` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationAction(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationAction + func pigeonApiWKNavigationAction(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKNavigationAction /// An implementation of [PigeonApiWKNavigationResponse] used to add a new Dart instance of /// `WKNavigationResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationResponse + func pigeonApiWKNavigationResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKNavigationResponse /// An implementation of [PigeonApiWKFrameInfo] used to add a new Dart instance of /// `WKFrameInfo` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKFrameInfo(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKFrameInfo + func pigeonApiWKFrameInfo(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKFrameInfo /// An implementation of [PigeonApiNSError] used to add a new Dart instance of /// `NSError` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiNSError(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSError /// An implementation of [PigeonApiWKScriptMessage] used to add a new Dart instance of /// `WKScriptMessage` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKScriptMessage(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKScriptMessage + func pigeonApiWKScriptMessage(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKScriptMessage /// An implementation of [PigeonApiWKSecurityOrigin] used to add a new Dart instance of /// `WKSecurityOrigin` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKSecurityOrigin(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKSecurityOrigin + func pigeonApiWKSecurityOrigin(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKSecurityOrigin /// An implementation of [PigeonApiHTTPCookie] used to add a new Dart instance of /// `HTTPCookie` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiHTTPCookie(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiHTTPCookie /// An implementation of [PigeonApiAuthenticationChallengeResponse] used to add a new Dart instance of /// `AuthenticationChallengeResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiAuthenticationChallengeResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiAuthenticationChallengeResponse + func pigeonApiAuthenticationChallengeResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiAuthenticationChallengeResponse /// An implementation of [PigeonApiWKWebsiteDataStore] used to add a new Dart instance of /// `WKWebsiteDataStore` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKWebsiteDataStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebsiteDataStore + func pigeonApiWKWebsiteDataStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKWebsiteDataStore /// An implementation of [PigeonApiUIView] used to add a new Dart instance of /// `UIView` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiUIView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIView /// An implementation of [PigeonApiUIScrollView] used to add a new Dart instance of /// `UIScrollView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIScrollView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIScrollView + func pigeonApiUIScrollView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIScrollView /// An implementation of [PigeonApiWKWebViewConfiguration] used to add a new Dart instance of /// `WKWebViewConfiguration` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKWebViewConfiguration(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebViewConfiguration + func pigeonApiWKWebViewConfiguration(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKWebViewConfiguration /// An implementation of [PigeonApiWKUserContentController] used to add a new Dart instance of /// `WKUserContentController` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUserContentController(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUserContentController + func pigeonApiWKUserContentController(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKUserContentController /// An implementation of [PigeonApiWKPreferences] used to add a new Dart instance of /// `WKPreferences` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKPreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKPreferences + func pigeonApiWKPreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKPreferences /// An implementation of [PigeonApiWKScriptMessageHandler] used to add a new Dart instance of /// `WKScriptMessageHandler` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKScriptMessageHandler(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKScriptMessageHandler + func pigeonApiWKScriptMessageHandler(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKScriptMessageHandler /// An implementation of [PigeonApiWKNavigationDelegate] used to add a new Dart instance of /// `WKNavigationDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKNavigationDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKNavigationDelegate + func pigeonApiWKNavigationDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKNavigationDelegate /// An implementation of [PigeonApiNSObject] used to add a new Dart instance of /// `NSObject` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiNSObject(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSObject /// An implementation of [PigeonApiUIViewWKWebView] used to add a new Dart instance of /// `UIViewWKWebView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIViewWKWebView + func pigeonApiUIViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIViewWKWebView /// An implementation of [PigeonApiNSViewWKWebView] used to add a new Dart instance of /// `NSViewWKWebView` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiNSViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiNSViewWKWebView + func pigeonApiNSViewWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiNSViewWKWebView /// An implementation of [PigeonApiWKWebView] used to add a new Dart instance of /// `WKWebView` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebView /// An implementation of [PigeonApiWKUIDelegate] used to add a new Dart instance of /// `WKUIDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKUIDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKUIDelegate + func pigeonApiWKUIDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKUIDelegate /// An implementation of [PigeonApiWKHTTPCookieStore] used to add a new Dart instance of /// `WKHTTPCookieStore` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiWKHTTPCookieStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKHTTPCookieStore + func pigeonApiWKHTTPCookieStore(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKHTTPCookieStore /// An implementation of [PigeonApiUIScrollViewDelegate] used to add a new Dart instance of /// `UIScrollViewDelegate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiUIScrollViewDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiUIScrollViewDelegate + func pigeonApiUIScrollViewDelegate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiUIScrollViewDelegate /// An implementation of [PigeonApiURLCredential] used to add a new Dart instance of /// `URLCredential` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLCredential(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLCredential + func pigeonApiURLCredential(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLCredential /// An implementation of [PigeonApiURLProtectionSpace] used to add a new Dart instance of /// `URLProtectionSpace` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLProtectionSpace(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLProtectionSpace + func pigeonApiURLProtectionSpace(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLProtectionSpace /// An implementation of [PigeonApiURLAuthenticationChallenge] used to add a new Dart instance of /// `URLAuthenticationChallenge` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiURLAuthenticationChallenge(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLAuthenticationChallenge + func pigeonApiURLAuthenticationChallenge(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLAuthenticationChallenge /// 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 + func pigeonApiWKWebpagePreferences(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiWKWebpagePreferences /// An implementation of [PigeonApiGetTrustResultResponse] used to add a new Dart instance of /// `GetTrustResultResponse` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiGetTrustResultResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiGetTrustResultResponse + func pigeonApiGetTrustResultResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiGetTrustResultResponse /// An implementation of [PigeonApiSecTrust] used to add a new Dart instance of /// `SecTrust` to the Dart `InstanceManager` and make calls to Dart. func pigeonApiSecTrust(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiSecTrust /// An implementation of [PigeonApiSecCertificate] used to add a new Dart instance of /// `SecCertificate` to the Dart `InstanceManager` and make calls to Dart. - func pigeonApiSecCertificate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiSecCertificate + func pigeonApiSecCertificate(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiSecCertificate } extension WebKitLibraryPigeonProxyApiDelegate { - func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiURLResponse { - return PigeonApiURLResponse(pigeonRegistrar: registrar, delegate: PigeonApiDelegateURLResponse()) + func pigeonApiURLResponse(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) + -> PigeonApiURLResponse + { + return PigeonApiURLResponse( + pigeonRegistrar: registrar, delegate: PigeonApiDelegateURLResponse()) } func pigeonApiWKWebView(_ registrar: WebKitLibraryPigeonProxyApiRegistrar) -> PigeonApiWKWebView { return PigeonApiWKWebView(pigeonRegistrar: registrar, delegate: PigeonApiDelegateWKWebView()) @@ -513,44 +556,74 @@ open class WebKitLibraryPigeonProxyApiRegistrar { } func setUp() { - WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: instanceManager) - PigeonApiURLRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLRequest(self)) - PigeonApiWKUserScript.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserScript(self)) - PigeonApiHTTPCookie.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiHTTPCookie(self)) - PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiAuthenticationChallengeResponse(self)) - PigeonApiWKWebsiteDataStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebsiteDataStore(self)) - PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(self)) - PigeonApiUIScrollView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollView(self)) - PigeonApiWKWebViewConfiguration.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebViewConfiguration(self)) - PigeonApiWKUserContentController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserContentController(self)) - PigeonApiWKPreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKPreferences(self)) - PigeonApiWKScriptMessageHandler.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKScriptMessageHandler(self)) - PigeonApiWKNavigationDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKNavigationDelegate(self)) - PigeonApiNSObject.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSObject(self)) - PigeonApiUIViewWKWebView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewWKWebView(self)) - PigeonApiNSViewWKWebView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSViewWKWebView(self)) - PigeonApiWKUIDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUIDelegate(self)) - PigeonApiWKHTTPCookieStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKHTTPCookieStore(self)) - PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) - PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) - PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) - PigeonApiURLAuthenticationChallenge.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) - PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) - PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) - PigeonApiSecTrust.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecTrust(self)) - PigeonApiSecCertificate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecCertificate(self)) + WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger: binaryMessenger, instanceManager: instanceManager) + PigeonApiURLRequest.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLRequest(self)) + PigeonApiWKUserScript.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserScript(self)) + PigeonApiHTTPCookie.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiHTTPCookie(self)) + PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers( + binaryMessenger: binaryMessenger, + api: apiDelegate.pigeonApiAuthenticationChallengeResponse(self)) + PigeonApiWKWebsiteDataStore.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebsiteDataStore(self)) + PigeonApiUIView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIView(self)) + PigeonApiUIScrollView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollView(self)) + PigeonApiWKWebViewConfiguration.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebViewConfiguration(self)) + PigeonApiWKUserContentController.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUserContentController(self)) + PigeonApiWKPreferences.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKPreferences(self)) + PigeonApiWKScriptMessageHandler.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKScriptMessageHandler(self)) + PigeonApiWKNavigationDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKNavigationDelegate(self)) + PigeonApiNSObject.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSObject(self)) + PigeonApiUIViewWKWebView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIViewWKWebView(self)) + PigeonApiNSViewWKWebView.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiNSViewWKWebView(self)) + PigeonApiWKUIDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKUIDelegate(self)) + PigeonApiWKHTTPCookieStore.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKHTTPCookieStore(self)) + PigeonApiUIScrollViewDelegate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiUIScrollViewDelegate(self)) + PigeonApiURLCredential.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLCredential(self)) + PigeonApiURLProtectionSpace.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLProtectionSpace(self)) + PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURLAuthenticationChallenge(self)) + PigeonApiURL.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiURL(self)) + PigeonApiWKWebpagePreferences.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiWKWebpagePreferences(self)) + PigeonApiSecTrust.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecTrust(self)) + PigeonApiSecCertificate.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: apiDelegate.pigeonApiSecCertificate(self)) } func tearDown() { - WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers(binaryMessenger: binaryMessenger, instanceManager: nil) + WebKitLibraryPigeonInstanceManagerApi.setUpMessageHandlers( + binaryMessenger: binaryMessenger, instanceManager: nil) PigeonApiURLRequest.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKUserScript.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiHTTPCookie.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiAuthenticationChallengeResponse.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebsiteDataStore.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiUIScrollView.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebViewConfiguration.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiWKUserContentController.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiWKUserContentController.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: nil) PigeonApiWKPreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKScriptMessageHandler.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKNavigationDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -562,7 +635,8 @@ open class WebKitLibraryPigeonProxyApiRegistrar { PigeonApiUIScrollViewDelegate.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLCredential.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiURLProtectionSpace.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) - PigeonApiURLAuthenticationChallenge.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) + PigeonApiURLAuthenticationChallenge.setUpMessageHandlers( + binaryMessenger: binaryMessenger, api: nil) PigeonApiURL.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiWKWebpagePreferences.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) PigeonApiSecTrust.setUpMessageHandlers(binaryMessenger: binaryMessenger, api: nil) @@ -605,252 +679,272 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand } override func writeValue(_ value: Any) { - if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String || value is KeyValueObservingOptions || value is KeyValueChange || value is KeyValueChangeKey || value is UserScriptInjectionTime || value is AudiovisualMediaType || value is WebsiteDataType || value is NavigationActionPolicy || value is NavigationResponsePolicy || value is HttpCookiePropertyKey || value is NavigationType || value is PermissionDecision || value is MediaCaptureType || value is UrlSessionAuthChallengeDisposition || value is UrlCredentialPersistence || value is DartSecTrustResultType { + if value is [Any] || value is Bool || value is Data || value is [AnyHashable: Any] + || value is Double || value is FlutterStandardTypedData || value is Int64 || value is String + || value is KeyValueObservingOptions || value is KeyValueChange + || value is KeyValueChangeKey || value is UserScriptInjectionTime + || value is AudiovisualMediaType || value is WebsiteDataType + || value is NavigationActionPolicy || value is NavigationResponsePolicy + || value is HttpCookiePropertyKey || value is NavigationType || value is PermissionDecision + || value is MediaCaptureType || value is UrlSessionAuthChallengeDisposition + || value is UrlCredentialPersistence || value is DartSecTrustResultType + { super.writeValue(value) return } - if let instance = value as? URLRequestWrapper { pigeonRegistrar.apiDelegate.pigeonApiURLRequest(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? HTTPURLResponse { pigeonRegistrar.apiDelegate.pigeonApiHTTPURLResponse(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? URLResponse { pigeonRegistrar.apiDelegate.pigeonApiURLResponse(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKUserScript { pigeonRegistrar.apiDelegate.pigeonApiWKUserScript(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKNavigationAction { pigeonRegistrar.apiDelegate.pigeonApiWKNavigationAction(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKNavigationResponse { - pigeonRegistrar.apiDelegate.pigeonApiWKNavigationResponse(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKNavigationResponse(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKFrameInfo { pigeonRegistrar.apiDelegate.pigeonApiWKFrameInfo(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? NSError { pigeonRegistrar.apiDelegate.pigeonApiNSError(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKScriptMessage { pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessage(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKSecurityOrigin { pigeonRegistrar.apiDelegate.pigeonApiWKSecurityOrigin(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? HTTPCookie { pigeonRegistrar.apiDelegate.pigeonApiHTTPCookie(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? AuthenticationChallengeResponse { - pigeonRegistrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiAuthenticationChallengeResponse(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKWebsiteDataStore { pigeonRegistrar.apiDelegate.pigeonApiWKWebsiteDataStore(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? UIScrollView { - pigeonRegistrar.apiDelegate.pigeonApiUIScrollView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIScrollView { + pigeonRegistrar.apiDelegate.pigeonApiUIScrollView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? WKWebViewConfiguration { - pigeonRegistrar.apiDelegate.pigeonApiWKWebViewConfiguration(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKWebViewConfiguration(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKUserContentController { - pigeonRegistrar.apiDelegate.pigeonApiWKUserContentController(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKUserContentController(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKPreferences { pigeonRegistrar.apiDelegate.pigeonApiWKPreferences(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKScriptMessageHandler { - pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessageHandler(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKScriptMessageHandler(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKNavigationDelegate { - pigeonRegistrar.apiDelegate.pigeonApiWKNavigationDelegate(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKNavigationDelegate(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? WKWebView { - pigeonRegistrar.apiDelegate.pigeonApiUIViewWKWebView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? WKWebView { + pigeonRegistrar.apiDelegate.pigeonApiUIViewWKWebView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif #if !os(macOS) - if let instance = value as? UIView { - pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIView { + pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif #if !os(iOS) - if let instance = value as? WKWebView { - pigeonRegistrar.apiDelegate.pigeonApiNSViewWKWebView(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? WKWebView { + pigeonRegistrar.apiDelegate.pigeonApiNSViewWKWebView(pigeonRegistrar).pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? WKWebView { @@ -859,42 +953,45 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKUIDelegate { pigeonRegistrar.apiDelegate.pigeonApiWKUIDelegate(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? WKHTTPCookieStore { pigeonRegistrar.apiDelegate.pigeonApiWKHTTPCookieStore(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } #if !os(macOS) - if let instance = value as? UIScrollViewDelegate { - pigeonRegistrar.apiDelegate.pigeonApiUIScrollViewDelegate(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } - super.writeByte(128) - super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) - return - } + if let instance = value as? UIScrollViewDelegate { + pigeonRegistrar.apiDelegate.pigeonApiUIScrollViewDelegate(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } + super.writeByte(128) + super.writeValue( + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) + return + } #endif if let instance = value as? URLCredential { @@ -903,100 +1000,104 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? URLProtectionSpace { pigeonRegistrar.apiDelegate.pigeonApiURLProtectionSpace(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? URLAuthenticationChallenge { - pigeonRegistrar.apiDelegate.pigeonApiURLAuthenticationChallenge(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiURLAuthenticationChallenge(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? URL { pigeonRegistrar.apiDelegate.pigeonApiURL(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if #available(iOS 13.0.0, macOS 10.15.0, *), let instance = value as? WKWebpagePreferences { - pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiWKWebpagePreferences(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? GetTrustResultResponse { - pigeonRegistrar.apiDelegate.pigeonApiGetTrustResultResponse(pigeonRegistrar).pigeonNewInstance( - pigeonInstance: instance - ) { _ in } + pigeonRegistrar.apiDelegate.pigeonApiGetTrustResultResponse(pigeonRegistrar) + .pigeonNewInstance( + pigeonInstance: instance + ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? SecTrustWrapper { pigeonRegistrar.apiDelegate.pigeonApiSecTrust(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? SecCertificateWrapper { pigeonRegistrar.apiDelegate.pigeonApiSecCertificate(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - if let instance = value as? NSObject { pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar).pigeonNewInstance( pigeonInstance: instance ) { _ in } super.writeByte(128) super.writeValue( - pigeonRegistrar.instanceManager.identifierWithStrongReference(forInstance: instance as AnyObject)!) + pigeonRegistrar.instanceManager.identifierWithStrongReference( + forInstance: instance as AnyObject)!) return } - - if let instance = value as AnyObject?, pigeonRegistrar.instanceManager.containsInstance(instance) + if let instance = value as AnyObject?, + pigeonRegistrar.instanceManager.containsInstance(instance) { super.writeByte(128) super.writeValue( @@ -1014,11 +1115,13 @@ private class WebKitLibraryPigeonInternalProxyApiCodecReaderWriter: FlutterStand } override func reader(with data: Data) -> FlutterStandardReader { - return WebKitLibraryPigeonInternalProxyApiCodecReader(data: data, pigeonRegistrar: pigeonRegistrar) + return WebKitLibraryPigeonInternalProxyApiCodecReader( + data: data, pigeonRegistrar: pigeonRegistrar) } override func writer(with data: NSMutableData) -> FlutterStandardWriter { - return WebKitLibraryPigeonInternalProxyApiCodecWriter(data: data, pigeonRegistrar: pigeonRegistrar) + return WebKitLibraryPigeonInternalProxyApiCodecWriter( + data: data, pigeonRegistrar: pigeonRegistrar) } } @@ -1479,27 +1582,36 @@ class WebKitLibraryPigeonCodec: FlutterStandardMessageCodec, @unchecked Sendable } protocol PigeonApiDelegateURLRequest { - func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws -> URLRequestWrapper + func pigeonDefaultConstructor(pigeonApi: PigeonApiURLRequest, url: String) throws + -> URLRequestWrapper /// The URL being requested. func getUrl(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? /// The HTTP request method. - func setHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws + func setHttpMethod( + pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, method: String?) throws /// The HTTP request method. - func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> String? + func getHttpMethod(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws + -> String? /// The request body. - func setHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, body: FlutterStandardTypedData?) throws + func setHttpBody( + pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, + body: FlutterStandardTypedData?) throws /// The request body. - func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> FlutterStandardTypedData? + func getHttpBody(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws + -> FlutterStandardTypedData? /// A dictionary containing all of the HTTP header fields for a request. - func setAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) throws + func setAllHttpHeaderFields( + pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper, fields: [String: String]?) + throws /// A dictionary containing all of the HTTP header fields for a request. - func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) throws -> [String: String]? + func getAllHttpHeaderFields(pigeonApi: PigeonApiURLRequest, pigeonInstance: URLRequestWrapper) + throws -> [String: String]? } protocol PigeonApiProtocolURLRequest { } -final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { +final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLRequest ///An implementation of [NSObject] used to access callback methods @@ -1507,17 +1619,23 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLRequest) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLRequest) + { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLRequest?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLRequest? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1525,8 +1643,8 @@ final class PigeonApiURLRequest: PigeonApiProtocolURLRequest { let urlArg = args[1] as! String do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: urlArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, url: urlArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1535,13 +1653,16 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getUrl", binaryMessenger: binaryMessenger, codec: codec) + let getUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getUrl", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getUrlChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1550,14 +1671,17 @@ withIdentifier: pigeonIdentifierArg) } else { getUrlChannel.setMessageHandler(nil) } - let setHttpMethodChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpMethod", binaryMessenger: binaryMessenger, codec: codec) + let setHttpMethodChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpMethod", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setHttpMethodChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let methodArg: String? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setHttpMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg, method: methodArg) + try api.pigeonDelegate.setHttpMethod( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, method: methodArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1566,13 +1690,16 @@ withIdentifier: pigeonIdentifierArg) } else { setHttpMethodChannel.setMessageHandler(nil) } - let getHttpMethodChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpMethod", binaryMessenger: binaryMessenger, codec: codec) + let getHttpMethodChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpMethod", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHttpMethodChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getHttpMethod(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getHttpMethod( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1581,14 +1708,17 @@ withIdentifier: pigeonIdentifierArg) } else { getHttpMethodChannel.setMessageHandler(nil) } - let setHttpBodyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpBody", binaryMessenger: binaryMessenger, codec: codec) + let setHttpBodyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setHttpBody", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setHttpBodyChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let bodyArg: FlutterStandardTypedData? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setHttpBody(pigeonApi: api, pigeonInstance: pigeonInstanceArg, body: bodyArg) + try api.pigeonDelegate.setHttpBody( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, body: bodyArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1597,13 +1727,16 @@ withIdentifier: pigeonIdentifierArg) } else { setHttpBodyChannel.setMessageHandler(nil) } - let getHttpBodyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpBody", binaryMessenger: binaryMessenger, codec: codec) + let getHttpBodyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getHttpBody", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getHttpBodyChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getHttpBody(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getHttpBody( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1612,14 +1745,17 @@ withIdentifier: pigeonIdentifierArg) } else { getHttpBodyChannel.setMessageHandler(nil) } - let setAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setAllHttpHeaderFields", binaryMessenger: binaryMessenger, codec: codec) + let setAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.setAllHttpHeaderFields", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAllHttpHeaderFieldsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper let fieldsArg: [String: String]? = nilOrValue(args[1]) do { - try api.pigeonDelegate.setAllHttpHeaderFields(pigeonApi: api, pigeonInstance: pigeonInstanceArg, fields: fieldsArg) + try api.pigeonDelegate.setAllHttpHeaderFields( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, fields: fieldsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1628,13 +1764,16 @@ withIdentifier: pigeonIdentifierArg) } else { setAllHttpHeaderFieldsChannel.setMessageHandler(nil) } - let getAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getAllHttpHeaderFields", binaryMessenger: binaryMessenger, codec: codec) + let getAllHttpHeaderFieldsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLRequest.getAllHttpHeaderFields", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAllHttpHeaderFieldsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLRequestWrapper do { - let result = try api.pigeonDelegate.getAllHttpHeaderFields(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAllHttpHeaderFields( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -1646,21 +1785,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of URLRequest and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLRequestWrapper, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLRequestWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -1680,13 +1824,14 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateHTTPURLResponse { /// The response’s HTTP status code. - func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws -> Int64 + func statusCode(pigeonApi: PigeonApiHTTPURLResponse, pigeonInstance: HTTPURLResponse) throws + -> Int64 } protocol PigeonApiProtocolHTTPURLResponse { } -final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { +final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateHTTPURLResponse ///An implementation of [URLResponse] used to access callback methods @@ -1694,27 +1839,36 @@ final class PigeonApiHTTPURLResponse: PigeonApiProtocolHTTPURLResponse { return pigeonRegistrar.apiDelegate.pigeonApiURLResponse(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPURLResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateHTTPURLResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of HTTPURLResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: HTTPURLResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: HTTPURLResponse, 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) { + } 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) + } 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) + 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))) @@ -1738,7 +1892,7 @@ open class PigeonApiDelegateURLResponse { protocol PigeonApiProtocolURLResponse { } -final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { +final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLResponse ///An implementation of [NSObject] used to access callback methods @@ -1746,26 +1900,33 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of URLResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLResponse, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -1786,20 +1947,25 @@ final class PigeonApiURLResponse: PigeonApiProtocolURLResponse { protocol PigeonApiDelegateWKUserScript { /// Creates a user script object that contains the specified source code and /// attributes. - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, isForMainFrameOnly: Bool) throws -> WKUserScript + func pigeonDefaultConstructor( + pigeonApi: PigeonApiWKUserScript, source: String, injectionTime: UserScriptInjectionTime, + isForMainFrameOnly: Bool + ) throws -> WKUserScript /// The script’s source code. func source(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> String /// The time at which to inject the script into the webpage. - func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> UserScriptInjectionTime + func injectionTime(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws + -> UserScriptInjectionTime /// A Boolean value that indicates whether to inject the script into the main /// frame or all frames. - func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws -> Bool + func isForMainFrameOnly(pigeonApi: PigeonApiWKUserScript, pigeonInstance: WKUserScript) throws + -> Bool } protocol PigeonApiProtocolWKUserScript { } -final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { +final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUserScript ///An implementation of [NSObject] used to access callback methods @@ -1807,17 +1973,24 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserScript) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserScript + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserScript?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserScript? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserScript.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -1827,8 +2000,10 @@ final class PigeonApiWKUserScript: PigeonApiProtocolWKUserScript { let isForMainFrameOnlyArg = args[3] as! Bool do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, source: sourceArg, injectionTime: injectionTimeArg, isForMainFrameOnly: isForMainFrameOnlyArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, source: sourceArg, injectionTime: injectionTimeArg, + isForMainFrameOnly: isForMainFrameOnlyArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -1840,25 +2015,34 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKUserScript and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKUserScript, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKUserScript, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -1877,19 +2061,22 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateWKNavigationAction { /// The URL request object associated with the navigation action. - func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> URLRequestWrapper + func request(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws + -> URLRequestWrapper /// The frame in which to display the new content. /// /// If the target of the navigation is a new window, this property is nil. - func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> WKFrameInfo? + func targetFrame(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) + throws -> WKFrameInfo? /// The type of action that triggered the navigation. - func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) throws -> NavigationType + func navigationType(pigeonApi: PigeonApiWKNavigationAction, pigeonInstance: WKNavigationAction) + throws -> NavigationType } protocol PigeonApiProtocolWKNavigationAction { } -final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { +final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationAction ///An implementation of [NSObject] used to access callback methods @@ -1897,30 +2084,42 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationAction) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKNavigationAction + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKNavigationAction and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKNavigationAction, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKNavigationAction, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -1939,16 +2138,19 @@ final class PigeonApiWKNavigationAction: PigeonApiProtocolWKNavigationAction { } protocol PigeonApiDelegateWKNavigationResponse { /// The frame’s response. - func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> URLResponse + func response(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) + throws -> URLResponse /// A Boolean value that indicates whether the response targets the web view’s /// main frame. - func isForMainFrame(pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse) throws -> Bool + func isForMainFrame( + pigeonApi: PigeonApiWKNavigationResponse, pigeonInstance: WKNavigationResponse + ) throws -> Bool } protocol PigeonApiProtocolWKNavigationResponse { } -final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse { +final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationResponse ///An implementation of [NSObject] used to access callback methods @@ -1956,29 +2158,40 @@ final class PigeonApiWKNavigationResponse: PigeonApiProtocolWKNavigationResponse return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKNavigationResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKNavigationResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKNavigationResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKNavigationResponse, 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) { + } 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) + } 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 + 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 @@ -2000,13 +2213,14 @@ protocol PigeonApiDelegateWKFrameInfo { /// or a subframe. func isMainFrame(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> Bool /// The frame’s current request. - func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws -> URLRequestWrapper? + func request(pigeonApi: PigeonApiWKFrameInfo, pigeonInstance: WKFrameInfo) throws + -> URLRequestWrapper? } protocol PigeonApiProtocolWKFrameInfo { } -final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { +final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKFrameInfo ///An implementation of [NSObject] used to access callback methods @@ -2014,28 +2228,36 @@ final class PigeonApiWKFrameInfo: PigeonApiProtocolWKFrameInfo { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKFrameInfo) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKFrameInfo + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKFrameInfo and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKFrameInfo, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKFrameInfo, 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) { + } 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) + } 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) + 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))) @@ -2065,7 +2287,7 @@ protocol PigeonApiDelegateNSError { protocol PigeonApiProtocolNSError { } -final class PigeonApiNSError: PigeonApiProtocolNSError { +final class PigeonApiNSError: PigeonApiProtocolNSError { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSError ///An implementation of [NSObject] used to access callback methods @@ -2078,25 +2300,32 @@ final class PigeonApiNSError: PigeonApiProtocolNSError { self.pigeonDelegate = delegate } ///Creates a Dart instance of NSError and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: NSError, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: NSError, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2123,7 +2352,7 @@ protocol PigeonApiDelegateWKScriptMessage { protocol PigeonApiProtocolWKScriptMessage { } -final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { +final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKScriptMessage ///An implementation of [NSObject] used to access callback methods @@ -2131,28 +2360,36 @@ final class PigeonApiWKScriptMessage: PigeonApiProtocolWKScriptMessage { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKScriptMessage) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKScriptMessage + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKScriptMessage and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKScriptMessage, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKScriptMessage, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -2176,13 +2413,14 @@ protocol PigeonApiDelegateWKSecurityOrigin { /// The security origin's port. func port(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> Int64 /// The security origin's protocol. - func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) throws -> String + func securityProtocol(pigeonApi: PigeonApiWKSecurityOrigin, pigeonInstance: WKSecurityOrigin) + throws -> String } protocol PigeonApiProtocolWKSecurityOrigin { } -final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { +final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKSecurityOrigin ///An implementation of [NSObject] used to access callback methods @@ -2190,30 +2428,40 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKSecurityOrigin) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKSecurityOrigin + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKSecurityOrigin and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKSecurityOrigin, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKSecurityOrigin, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -2231,15 +2479,18 @@ final class PigeonApiWKSecurityOrigin: PigeonApiProtocolWKSecurityOrigin { } } protocol PigeonApiDelegateHTTPCookie { - func pigeonDefaultConstructor(pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any]) throws -> HTTPCookie + func pigeonDefaultConstructor( + pigeonApi: PigeonApiHTTPCookie, properties: [HttpCookiePropertyKey: Any] + ) throws -> HTTPCookie /// The cookie’s properties. - func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws -> [HttpCookiePropertyKey: Any]? + func getProperties(pigeonApi: PigeonApiHTTPCookie, pigeonInstance: HTTPCookie) throws + -> [HttpCookiePropertyKey: Any]? } protocol PigeonApiProtocolHTTPCookie { } -final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { +final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateHTTPCookie ///An implementation of [NSObject] used to access callback methods @@ -2247,17 +2498,23 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPCookie) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateHTTPCookie) + { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiHTTPCookie?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiHTTPCookie? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2265,8 +2522,9 @@ final class PigeonApiHTTPCookie: PigeonApiProtocolHTTPCookie { let propertiesArg = args[1] as? [HttpCookiePropertyKey: Any] do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, properties: propertiesArg!), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, properties: propertiesArg!), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2275,13 +2533,16 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let getPropertiesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.getProperties", binaryMessenger: binaryMessenger, codec: codec) + let getPropertiesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.HTTPCookie.getProperties", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getPropertiesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! HTTPCookie do { - let result = try api.pigeonDelegate.getProperties(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getProperties( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -2293,21 +2554,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of HTTPCookie and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: HTTPCookie, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: HTTPCookie, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -2330,37 +2596,60 @@ protocol PigeonApiDelegateAuthenticationChallengeResponse { /// /// Due to https://github.com/flutter/flutter/issues/162437, this should only /// be used for testing. - func pigeonDefaultConstructor(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?) throws -> AuthenticationChallengeResponse + func pigeonDefaultConstructor( + pigeonApi: PigeonApiAuthenticationChallengeResponse, + disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential? + ) throws -> AuthenticationChallengeResponse /// The option to use to handle the challenge. - func disposition(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> UrlSessionAuthChallengeDisposition + func disposition( + pigeonApi: PigeonApiAuthenticationChallengeResponse, + pigeonInstance: AuthenticationChallengeResponse + ) throws -> UrlSessionAuthChallengeDisposition /// The credential to use for authentication when the disposition parameter /// contains the value URLSession.AuthChallengeDisposition.useCredential. - func credential(pigeonApi: PigeonApiAuthenticationChallengeResponse, pigeonInstance: AuthenticationChallengeResponse) throws -> URLCredential? + func credential( + pigeonApi: PigeonApiAuthenticationChallengeResponse, + pigeonInstance: AuthenticationChallengeResponse + ) throws -> URLCredential? /// Creates an [AuthenticationChallengeResponse] /// /// This provides the native `AuthenticationChallengeResponse()` constructor /// as an async method to ensure the class is added to the InstanceManager. /// See https://github.com/flutter/flutter/issues/162437. - func createAsync(pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, completion: @escaping (Result) -> Void) + func createAsync( + pigeonApi: PigeonApiAuthenticationChallengeResponse, + disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, + completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolAuthenticationChallengeResponse { } -final class PigeonApiAuthenticationChallengeResponse: PigeonApiProtocolAuthenticationChallengeResponse { +final class PigeonApiAuthenticationChallengeResponse: + PigeonApiProtocolAuthenticationChallengeResponse +{ unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateAuthenticationChallengeResponse - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateAuthenticationChallengeResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateAuthenticationChallengeResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiAuthenticationChallengeResponse?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiAuthenticationChallengeResponse? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -2369,8 +2658,9 @@ final class PigeonApiAuthenticationChallengeResponse: PigeonApiProtocolAuthentic let credentialArg: URLCredential? = nilOrValue(args[2]) do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, disposition: dispositionArg, credential: credentialArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, disposition: dispositionArg, credential: credentialArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2379,13 +2669,18 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let createAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.createAsync", binaryMessenger: binaryMessenger, codec: codec) + let createAsyncChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.AuthenticationChallengeResponse.createAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { createAsyncChannel.setMessageHandler { message, reply in let args = message as! [Any?] let dispositionArg = args[0] as! UrlSessionAuthChallengeDisposition let credentialArg: URLCredential? = nilOrValue(args[1]) - api.pigeonDelegate.createAsync(pigeonApi: api, disposition: dispositionArg, credential: credentialArg) { result in + api.pigeonDelegate.createAsync( + pigeonApi: api, disposition: dispositionArg, credential: credentialArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2400,24 +2695,33 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of AuthenticationChallengeResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: AuthenticationChallengeResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: AuthenticationChallengeResponse, + 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) { + } 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) + } 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 + 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 @@ -2438,15 +2742,19 @@ protocol PigeonApiDelegateWKWebsiteDataStore { /// The default data store, which stores data persistently to disk. func defaultDataStore(pigeonApi: PigeonApiWKWebsiteDataStore) throws -> WKWebsiteDataStore /// The object that manages the HTTP cookies for your website. - func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore) throws -> WKHTTPCookieStore + func httpCookieStore(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore) + throws -> WKHTTPCookieStore /// Removes the specified types of website data from one or more data records. - func removeDataOfTypes(pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, completion: @escaping (Result) -> Void) + func removeDataOfTypes( + pigeonApi: PigeonApiWKWebsiteDataStore, pigeonInstance: WKWebsiteDataStore, + dataTypes: [WebsiteDataType], modificationTimeInSecondsSinceEpoch: Double, + completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolWKWebsiteDataStore { } -final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { +final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebsiteDataStore ///An implementation of [NSObject] used to access callback methods @@ -2454,23 +2762,33 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebsiteDataStore) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKWebsiteDataStore + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebsiteDataStore?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebsiteDataStore? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let defaultDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.defaultDataStore", binaryMessenger: binaryMessenger, codec: codec) + let defaultDataStoreChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.defaultDataStore", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { defaultDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.defaultDataStore(pigeonApi: api), withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.defaultDataStore(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2479,14 +2797,19 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } else { defaultDataStoreChannel.setMessageHandler(nil) } - let httpCookieStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.httpCookieStore", binaryMessenger: binaryMessenger, codec: codec) + let httpCookieStoreChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.httpCookieStore", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { httpCookieStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebsiteDataStore let pigeonIdentifierArg = args[1] as! Int64 do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.httpCookieStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.httpCookieStore( + pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2495,14 +2818,19 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } else { httpCookieStoreChannel.setMessageHandler(nil) } - let removeDataOfTypesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.removeDataOfTypes", binaryMessenger: binaryMessenger, codec: codec) + let removeDataOfTypesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebsiteDataStore.removeDataOfTypes", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeDataOfTypesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebsiteDataStore let dataTypesArg = args[1] as! [WebsiteDataType] let modificationTimeInSecondsSinceEpochArg = args[2] as! Double - api.pigeonDelegate.removeDataOfTypes(pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataTypes: dataTypesArg, modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpochArg) { result in + api.pigeonDelegate.removeDataOfTypes( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataTypes: dataTypesArg, + modificationTimeInSecondsSinceEpoch: modificationTimeInSecondsSinceEpochArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -2517,21 +2845,26 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } ///Creates a Dart instance of WKWebsiteDataStore and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebsiteDataStore, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKWebsiteDataStore, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -2551,19 +2884,20 @@ final class PigeonApiWKWebsiteDataStore: PigeonApiProtocolWKWebsiteDataStore { } protocol PigeonApiDelegateUIView { #if !os(macOS) - /// The view’s background color. - func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) throws + /// The view’s background color. + func setBackgroundColor(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, value: Int64?) + throws #endif #if !os(macOS) - /// A Boolean value that determines whether the view is opaque. - func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws + /// A Boolean value that determines whether the view is opaque. + func setOpaque(pigeonApi: PigeonApiUIView, pigeonInstance: UIView, opaque: Bool) throws #endif } protocol PigeonApiProtocolUIView { } -final class PigeonApiUIView: PigeonApiProtocolUIView { +final class PigeonApiUIView: PigeonApiProtocolUIView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIView ///An implementation of [NSObject] used to access callback methods @@ -2579,140 +2913,162 @@ final class PigeonApiUIView: PigeonApiProtocolUIView { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let setBackgroundColorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setBackgroundColor", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBackgroundColorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIView - let valueArg: Int64? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setBackgroundColor(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setBackgroundColorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setBackgroundColor", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBackgroundColorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIView + let valueArg: Int64? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setBackgroundColor( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setBackgroundColorChannel.setMessageHandler(nil) } - } else { - setBackgroundColorChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setOpaqueChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setOpaque", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setOpaqueChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIView - let opaqueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setOpaque(pigeonApi: api, pigeonInstance: pigeonInstanceArg, opaque: opaqueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setOpaqueChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIView.setOpaque", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setOpaqueChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIView + let opaqueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setOpaque( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, opaque: opaqueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setOpaqueChannel.setMessageHandler(nil) } - } else { - setOpaqueChannel.setMessageHandler(nil) - } #endif } #if !os(macOS) - ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: UIView, 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.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(())) + ///Creates a Dart instance of UIView and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: UIView, 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.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(())) + } } } } - } #endif } protocol PigeonApiDelegateUIScrollView { #if !os(macOS) - /// The point at which the origin of the content view is offset from the - /// origin of the scroll view. - func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws -> [Double] + /// The point at which the origin of the content view is offset from the + /// origin of the scroll view. + func getContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView) throws + -> [Double] #endif #if !os(macOS) - /// Move the scrolled position of your view. - /// - /// Convenience method to synchronize change to the x and y scroll position. - func scrollBy(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws + /// Move the scrolled position of your view. + /// + /// Convenience method to synchronize change to the x and y scroll position. + func scrollBy( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws #endif #if !os(macOS) - /// The point at which the origin of the content view is offset from the - /// origin of the scroll view. - func setContentOffset(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws + /// The point at which the origin of the content view is offset from the + /// origin of the scroll view. + func setContentOffset( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, x: Double, y: Double) throws #endif #if !os(macOS) - /// The delegate of the scroll view. - func setDelegate(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, delegate: UIScrollViewDelegate?) throws + /// The delegate of the scroll view. + func setDelegate( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, + delegate: UIScrollViewDelegate?) throws #endif #if !os(macOS) - /// Whether the scroll view bounces past the edge of content and back again. - func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces past the edge of content and back again. + func setBounces(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) + throws #endif #if !os(macOS) - /// Whether the scroll view bounces when it reaches the ends of its horizontal - /// axis. - func setBouncesHorizontally(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces when it reaches the ends of its horizontal + /// axis. + func setBouncesHorizontally( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether the scroll view bounces when it reaches the ends of its vertical - /// axis. - func setBouncesVertically(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether the scroll view bounces when it reaches the ends of its vertical + /// axis. + func setBouncesVertically( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether bouncing always occurs when vertical scrolling reaches the end of - /// the content. - /// - /// If the value of this property is true and `bouncesVertically` is true, the - /// scroll view allows vertical dragging even if the content is smaller than - /// the bounds of the scroll view. - func setAlwaysBounceVertical(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether bouncing always occurs when vertical scrolling reaches the end of + /// the content. + /// + /// If the value of this property is true and `bouncesVertically` is true, the + /// scroll view allows vertical dragging even if the content is smaller than + /// the bounds of the scroll view. + func setAlwaysBounceVertical( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif #if !os(macOS) - /// Whether bouncing always occurs when horizontal scrolling reaches the end - /// of the content view. - /// - /// If the value of this property is true and `bouncesHorizontally` is true, - /// the scroll view allows horizontal dragging even if the content is smaller - /// than the bounds of the scroll view. - func setAlwaysBounceHorizontal(pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws + /// Whether bouncing always occurs when horizontal scrolling reaches the end + /// of the content view. + /// + /// If the value of this property is true and `bouncesHorizontally` is true, + /// the scroll view allows horizontal dragging even if the content is smaller + /// than the bounds of the scroll view. + func setAlwaysBounceHorizontal( + pigeonApi: PigeonApiUIScrollView, pigeonInstance: UIScrollView, value: Bool) throws #endif } protocol PigeonApiProtocolUIScrollView { } -final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { +final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIScrollView ///An implementation of [UIView] used to access callback methods @@ -2720,251 +3076,309 @@ final class PigeonApiUIScrollView: PigeonApiProtocolUIScrollView { return pigeonRegistrar.apiDelegate.pigeonApiUIView(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollView) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollView + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollView?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollView? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let getContentOffsetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.getContentOffset", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getContentOffsetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - do { - let result = try api.pigeonDelegate.getContentOffset(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getContentOffsetChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.getContentOffset", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getContentOffsetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + do { + let result = try api.pigeonDelegate.getContentOffset( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getContentOffsetChannel.setMessageHandler(nil) } - } else { - getContentOffsetChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let scrollByChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.scrollBy", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - scrollByChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let xArg = args[1] as! Double - let yArg = args[2] as! Double - do { - try api.pigeonDelegate.scrollBy(pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let scrollByChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.scrollBy", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + scrollByChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let xArg = args[1] as! Double + let yArg = args[2] as! Double + do { + try api.pigeonDelegate.scrollBy( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + scrollByChannel.setMessageHandler(nil) } - } else { - scrollByChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setContentOffsetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setContentOffset", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setContentOffsetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let xArg = args[1] as! Double - let yArg = args[2] as! Double - do { - try api.pigeonDelegate.setContentOffset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setContentOffsetChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setContentOffset", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setContentOffsetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let xArg = args[1] as! Double + let yArg = args[2] as! Double + do { + try api.pigeonDelegate.setContentOffset( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, x: xArg, y: yArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setContentOffsetChannel.setMessageHandler(nil) } - } else { - setContentOffsetChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let delegateArg: UIScrollViewDelegate? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let delegateArg: UIScrollViewDelegate? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setDelegateChannel.setMessageHandler(nil) } - } else { - setDelegateChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setBouncesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBounces", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBounces(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setBouncesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBounces", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBounces( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setBouncesChannel.setMessageHandler(nil) } - } else { - setBouncesChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setBouncesHorizontallyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesHorizontally", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesHorizontallyChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBouncesHorizontally(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setBouncesHorizontallyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesHorizontally", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesHorizontallyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBouncesHorizontally( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setBouncesHorizontallyChannel.setMessageHandler(nil) } - } else { - setBouncesHorizontallyChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setBouncesVerticallyChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesVertically", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setBouncesVerticallyChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setBouncesVertically(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setBouncesVerticallyChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setBouncesVertically", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setBouncesVerticallyChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setBouncesVertically( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setBouncesVerticallyChannel.setMessageHandler(nil) } - } else { - setBouncesVerticallyChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setAlwaysBounceVerticalChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceVertical", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAlwaysBounceVerticalChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAlwaysBounceVertical(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAlwaysBounceVerticalChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceVertical", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAlwaysBounceVerticalChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAlwaysBounceVertical( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAlwaysBounceVerticalChannel.setMessageHandler(nil) } - } else { - setAlwaysBounceVerticalChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setAlwaysBounceHorizontalChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceHorizontal", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAlwaysBounceHorizontalChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! UIScrollView - let valueArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAlwaysBounceHorizontal(pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAlwaysBounceHorizontalChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollView.setAlwaysBounceHorizontal", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAlwaysBounceHorizontalChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! UIScrollView + let valueArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAlwaysBounceHorizontal( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, value: valueArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAlwaysBounceHorizontalChannel.setMessageHandler(nil) } - } else { - setAlwaysBounceHorizontalChannel.setMessageHandler(nil) - } #endif } #if !os(macOS) - ///Creates a Dart instance of UIScrollView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: UIScrollView, 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.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(())) + ///Creates a Dart instance of UIScrollView and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: UIScrollView, 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.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(())) + } } } } - } #endif } protocol PigeonApiDelegateWKWebViewConfiguration { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws -> WKWebViewConfiguration + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKWebViewConfiguration) throws + -> WKWebViewConfiguration /// The object that coordinates interactions between your app’s native code /// and the webpage’s scripts and other content. - func setUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, controller: WKUserContentController) throws + func setUserContentController( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, + controller: WKUserContentController) throws /// The object that coordinates interactions between your app’s native code /// and the webpage’s scripts and other content. - func getUserContentController(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKUserContentController + func getUserContentController( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKUserContentController /// The object you use to get and set the site’s cookies and to track the /// cached data objects. - func setWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, dataStore: WKWebsiteDataStore) throws + func setWebsiteDataStore( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, + dataStore: WKWebsiteDataStore) throws /// The object you use to get and set the site’s cookies and to track the /// cached data objects. - func getWebsiteDataStore(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKWebsiteDataStore + func getWebsiteDataStore( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKWebsiteDataStore /// The object that manages the preference-related settings for the web view. - func setPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, preferences: WKPreferences) throws + func setPreferences( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, + preferences: WKPreferences) throws /// The object that manages the preference-related settings for the web view. - func getPreferences(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration) throws -> WKPreferences + func getPreferences( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKPreferences /// A Boolean value that indicates whether HTML5 videos play inline or use the /// native full-screen controller. - func setAllowsInlineMediaPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) throws + func setAllowsInlineMediaPlayback( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, allow: Bool) + throws /// A Boolean value that indicates whether the web view limits navigation to /// pages within the app’s domain. - func setLimitsNavigationsToAppBoundDomains(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) throws + func setLimitsNavigationsToAppBoundDomains( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, limit: Bool) + throws /// The media types that require a user gesture to begin playing. - func setMediaTypesRequiringUserActionForPlayback(pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration, type: AudiovisualMediaType) throws + 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 + func getDefaultWebpagePreferences( + pigeonApi: PigeonApiWKWebViewConfiguration, pigeonInstance: WKWebViewConfiguration + ) throws -> WKWebpagePreferences } protocol PigeonApiProtocolWKWebViewConfiguration { } -final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfiguration { +final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfiguration { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebViewConfiguration ///An implementation of [NSObject] used to access callback methods @@ -2972,25 +3386,34 @@ final class PigeonApiWKWebViewConfiguration: PigeonApiProtocolWKWebViewConfigura return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebViewConfiguration) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKWebViewConfiguration + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebViewConfiguration?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebViewConfiguration? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -2999,14 +3422,18 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let setUserContentControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setUserContentController", binaryMessenger: binaryMessenger, codec: codec) + let setUserContentControllerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setUserContentController", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setUserContentControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let controllerArg = args[1] as! WKUserContentController do { - try api.pigeonDelegate.setUserContentController(pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) + try api.pigeonDelegate.setUserContentController( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, controller: controllerArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3015,13 +3442,17 @@ withIdentifier: pigeonIdentifierArg) } else { setUserContentControllerChannel.setMessageHandler(nil) } - let getUserContentControllerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getUserContentController", binaryMessenger: binaryMessenger, codec: codec) + let getUserContentControllerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getUserContentController", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getUserContentControllerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getUserContentController(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getUserContentController( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3030,14 +3461,18 @@ withIdentifier: pigeonIdentifierArg) } else { getUserContentControllerChannel.setMessageHandler(nil) } - let setWebsiteDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setWebsiteDataStore", binaryMessenger: binaryMessenger, codec: codec) + let setWebsiteDataStoreChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setWebsiteDataStore", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setWebsiteDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let dataStoreArg = args[1] as! WKWebsiteDataStore do { - try api.pigeonDelegate.setWebsiteDataStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataStore: dataStoreArg) + try api.pigeonDelegate.setWebsiteDataStore( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, dataStore: dataStoreArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3046,13 +3481,17 @@ withIdentifier: pigeonIdentifierArg) } else { setWebsiteDataStoreChannel.setMessageHandler(nil) } - let getWebsiteDataStoreChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getWebsiteDataStore", binaryMessenger: binaryMessenger, codec: codec) + let getWebsiteDataStoreChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getWebsiteDataStore", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getWebsiteDataStoreChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getWebsiteDataStore(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getWebsiteDataStore( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3061,14 +3500,17 @@ withIdentifier: pigeonIdentifierArg) } else { getWebsiteDataStoreChannel.setMessageHandler(nil) } - let setPreferencesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setPreferences", binaryMessenger: binaryMessenger, codec: codec) + let setPreferencesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setPreferences", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setPreferencesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let preferencesArg = args[1] as! WKPreferences do { - try api.pigeonDelegate.setPreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg, preferences: preferencesArg) + try api.pigeonDelegate.setPreferences( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, preferences: preferencesArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3077,13 +3519,16 @@ withIdentifier: pigeonIdentifierArg) } else { setPreferencesChannel.setMessageHandler(nil) } - let getPreferencesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getPreferences", binaryMessenger: binaryMessenger, codec: codec) + let getPreferencesChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getPreferences", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getPreferencesChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration do { - let result = try api.pigeonDelegate.getPreferences(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getPreferences( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3092,14 +3537,18 @@ withIdentifier: pigeonIdentifierArg) } else { getPreferencesChannel.setMessageHandler(nil) } - let setAllowsInlineMediaPlaybackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setAllowsInlineMediaPlayback", binaryMessenger: binaryMessenger, codec: codec) + let setAllowsInlineMediaPlaybackChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setAllowsInlineMediaPlayback", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setAllowsInlineMediaPlaybackChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let allowArg = args[1] as! Bool do { - try api.pigeonDelegate.setAllowsInlineMediaPlayback(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + try api.pigeonDelegate.setAllowsInlineMediaPlayback( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3108,14 +3557,18 @@ withIdentifier: pigeonIdentifierArg) } else { setAllowsInlineMediaPlaybackChannel.setMessageHandler(nil) } - let setLimitsNavigationsToAppBoundDomainsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains", binaryMessenger: binaryMessenger, codec: codec) + let setLimitsNavigationsToAppBoundDomainsChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setLimitsNavigationsToAppBoundDomains", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setLimitsNavigationsToAppBoundDomainsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let limitArg = args[1] as! Bool do { - try api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains(pigeonApi: api, pigeonInstance: pigeonInstanceArg, limit: limitArg) + try api.pigeonDelegate.setLimitsNavigationsToAppBoundDomains( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, limit: limitArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3124,14 +3577,18 @@ withIdentifier: pigeonIdentifierArg) } else { setLimitsNavigationsToAppBoundDomainsChannel.setMessageHandler(nil) } - let setMediaTypesRequiringUserActionForPlaybackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback", binaryMessenger: binaryMessenger, codec: codec) + let setMediaTypesRequiringUserActionForPlaybackChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.setMediaTypesRequiringUserActionForPlayback", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setMediaTypesRequiringUserActionForPlaybackChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKWebViewConfiguration let typeArg = args[1] as! AudiovisualMediaType do { - try api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback(pigeonApi: api, pigeonInstance: pigeonInstanceArg, type: typeArg) + try api.pigeonDelegate.setMediaTypesRequiringUserActionForPlayback( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, type: typeArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3141,13 +3598,17 @@ withIdentifier: pigeonIdentifierArg) 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) + 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) + let result = try api.pigeonDelegate.getDefaultWebpagePreferences( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -3156,16 +3617,21 @@ withIdentifier: pigeonIdentifierArg) } else { getDefaultWebpagePreferencesChannel.setMessageHandler(nil) } - } else { + } else { let getDefaultWebpagePreferencesChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebViewConfiguration.getDefaultWebpagePreferences", + 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 - ))) + 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) @@ -3174,21 +3640,27 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKWebViewConfiguration and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebViewConfiguration, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKWebViewConfiguration, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -3208,23 +3680,31 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateWKUserContentController { /// Installs a message handler that you can call from your JavaScript code. - func addScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, handler: WKScriptMessageHandler, name: String) throws + func addScriptMessageHandler( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, + handler: WKScriptMessageHandler, name: String) throws /// Uninstalls the custom message handler with the specified name from your /// JavaScript code. - func removeScriptMessageHandler(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, name: String) throws + func removeScriptMessageHandler( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, + name: String) throws /// Uninstalls all custom message handlers associated with the user content /// controller. - func removeAllScriptMessageHandlers(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws + func removeAllScriptMessageHandlers( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws /// Injects the specified script into the webpage’s content. - func addUserScript(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, userScript: WKUserScript) throws + func addUserScript( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController, + userScript: WKUserScript) throws /// Removes all user scripts from the web view. - func removeAllUserScripts(pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws + func removeAllUserScripts( + pigeonApi: PigeonApiWKUserContentController, pigeonInstance: WKUserContentController) throws } protocol PigeonApiProtocolWKUserContentController { } -final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentController { +final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentController { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUserContentController ///An implementation of [NSObject] used to access callback methods @@ -3232,17 +3712,26 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUserContentController) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKUserContentController + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserContentController?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUserContentController? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let addScriptMessageHandlerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addScriptMessageHandler", binaryMessenger: binaryMessenger, codec: codec) + let addScriptMessageHandlerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addScriptMessageHandler", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { addScriptMessageHandlerChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3250,7 +3739,8 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont let handlerArg = args[1] as! WKScriptMessageHandler let nameArg = args[2] as! String do { - try api.pigeonDelegate.addScriptMessageHandler(pigeonApi: api, pigeonInstance: pigeonInstanceArg, handler: handlerArg, name: nameArg) + try api.pigeonDelegate.addScriptMessageHandler( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, handler: handlerArg, name: nameArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3259,14 +3749,18 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { addScriptMessageHandlerChannel.setMessageHandler(nil) } - let removeScriptMessageHandlerChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeScriptMessageHandler", binaryMessenger: binaryMessenger, codec: codec) + let removeScriptMessageHandlerChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeScriptMessageHandler", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeScriptMessageHandlerChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController let nameArg = args[1] as! String do { - try api.pigeonDelegate.removeScriptMessageHandler(pigeonApi: api, pigeonInstance: pigeonInstanceArg, name: nameArg) + try api.pigeonDelegate.removeScriptMessageHandler( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, name: nameArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3275,13 +3769,17 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { removeScriptMessageHandlerChannel.setMessageHandler(nil) } - let removeAllScriptMessageHandlersChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllScriptMessageHandlers", binaryMessenger: binaryMessenger, codec: codec) + let removeAllScriptMessageHandlersChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllScriptMessageHandlers", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeAllScriptMessageHandlersChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController do { - try api.pigeonDelegate.removeAllScriptMessageHandlers(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.removeAllScriptMessageHandlers( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3290,14 +3788,17 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { removeAllScriptMessageHandlersChannel.setMessageHandler(nil) } - let addUserScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addUserScript", binaryMessenger: binaryMessenger, codec: codec) + let addUserScriptChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.addUserScript", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { addUserScriptChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController let userScriptArg = args[1] as! WKUserScript do { - try api.pigeonDelegate.addUserScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userScript: userScriptArg) + try api.pigeonDelegate.addUserScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, userScript: userScriptArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3306,13 +3807,17 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } else { addUserScriptChannel.setMessageHandler(nil) } - let removeAllUserScriptsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllUserScripts", binaryMessenger: binaryMessenger, codec: codec) + let removeAllUserScriptsChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUserContentController.removeAllUserScripts", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeAllUserScriptsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKUserContentController do { - try api.pigeonDelegate.removeAllUserScripts(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + try api.pigeonDelegate.removeAllUserScripts( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3324,21 +3829,27 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } ///Creates a Dart instance of WKUserContentController and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKUserContentController, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKUserContentController, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -3358,13 +3869,14 @@ final class PigeonApiWKUserContentController: PigeonApiProtocolWKUserContentCont } protocol PigeonApiDelegateWKPreferences { /// A Boolean value that indicates whether JavaScript is enabled. - func setJavaScriptEnabled(pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws + func setJavaScriptEnabled( + pigeonApi: PigeonApiWKPreferences, pigeonInstance: WKPreferences, enabled: Bool) throws } protocol PigeonApiProtocolWKPreferences { } -final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { +final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKPreferences ///An implementation of [NSObject] used to access callback methods @@ -3372,24 +3884,32 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKPreferences) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKPreferences + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKPreferences?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKPreferences? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setJavaScriptEnabledChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.setJavaScriptEnabled", binaryMessenger: binaryMessenger, codec: codec) + let setJavaScriptEnabledChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKPreferences.setJavaScriptEnabled", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setJavaScriptEnabledChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKPreferences let enabledArg = args[1] as! Bool do { - try api.pigeonDelegate.setJavaScriptEnabled(pigeonApi: api, pigeonInstance: pigeonInstanceArg, enabled: enabledArg) + try api.pigeonDelegate.setJavaScriptEnabled( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, enabled: enabledArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3401,21 +3921,26 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } ///Creates a Dart instance of WKPreferences and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKPreferences, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKPreferences, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -3434,15 +3959,19 @@ final class PigeonApiWKPreferences: PigeonApiProtocolWKPreferences { } } protocol PigeonApiDelegateWKScriptMessageHandler { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws -> WKScriptMessageHandler + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKScriptMessageHandler) throws + -> WKScriptMessageHandler } protocol PigeonApiProtocolWKScriptMessageHandler { /// Tells the handler that a webpage sent a script message. - func didReceiveScriptMessage(pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, completion: @escaping (Result) -> Void) + func didReceiveScriptMessage( + pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, + controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, + completion: @escaping (Result) -> Void) } -final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHandler { +final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHandler { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKScriptMessageHandler ///An implementation of [NSObject] used to access callback methods @@ -3450,25 +3979,34 @@ final class PigeonApiWKScriptMessageHandler: PigeonApiProtocolWKScriptMessageHan return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKScriptMessageHandler) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKScriptMessageHandler + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKScriptMessageHandler?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKScriptMessageHandler? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3480,25 +4018,34 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKScriptMessageHandler and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKScriptMessageHandler, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKScriptMessageHandler, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + message: + "Error: Attempting to create a new Dart instance of WKScriptMessageHandler, but the class has a nonnull callback method.", + details: ""))) } } /// Tells the handler that a webpage sent a script message. - func didReceiveScriptMessage(pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, completion: @escaping (Result) -> Void) { + func didReceiveScriptMessage( + pigeonInstance pigeonInstanceArg: WKScriptMessageHandler, + controller controllerArg: WKUserContentController, message messageArg: WKScriptMessage, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3509,8 +4056,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.didReceiveScriptMessage" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKScriptMessageHandler.didReceiveScriptMessage" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, controllerArg, messageArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3529,32 +4078,52 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateWKNavigationDelegate { - func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws -> WKNavigationDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiWKNavigationDelegate) throws + -> WKNavigationDelegate } protocol PigeonApiProtocolWKNavigationDelegate { /// Tells the delegate that navigation is complete. - func didFinishNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) + func didFinishNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + url urlArg: String?, completion: @escaping (Result) -> Void) /// Tells the delegate that navigation from the main frame has started. - func didStartProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) + func didStartProvisionalNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + url urlArg: String?, completion: @escaping (Result) -> Void) /// Asks the delegate for permission to navigate to new content based on the /// specified action information. - func decidePolicyForNavigationAction(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) + func decidePolicyForNavigationAction( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + navigationAction navigationActionArg: WKNavigationAction, + completion: @escaping (Result) -> Void) /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. - func decidePolicyForNavigationResponse(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationResponse navigationResponseArg: WKNavigationResponse, completion: @escaping (Result) -> Void) + func decidePolicyForNavigationResponse( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + navigationResponse navigationResponseArg: WKNavigationResponse, + completion: @escaping (Result) -> Void) /// Tells the delegate that an error occurred during navigation. - func didFailNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) + func didFailNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + error errorArg: NSError, completion: @escaping (Result) -> Void) /// Tells the delegate that an error occurred during the early navigation /// process. - func didFailProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) + func didFailProvisionalNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + error errorArg: NSError, completion: @escaping (Result) -> Void) /// Tells the delegate that the web view’s content process was terminated. - func webViewWebContentProcessDidTerminate(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, completion: @escaping (Result) -> Void) + func webViewWebContentProcessDidTerminate( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + completion: @escaping (Result) -> Void) /// Asks the delegate to respond to an authentication challenge. - func didReceiveAuthenticationChallenge(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping (Result) -> Void) + func didReceiveAuthenticationChallenge( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + challenge challengeArg: URLAuthenticationChallenge, + completion: @escaping (Result) -> Void) } -final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate { +final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKNavigationDelegate ///An implementation of [NSObject] used to access callback methods @@ -3562,25 +4131,34 @@ final class PigeonApiWKNavigationDelegate: PigeonApiProtocolWKNavigationDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKNavigationDelegate) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKNavigationDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKNavigationDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKNavigationDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3592,25 +4170,32 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKNavigationDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKNavigationDelegate, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKNavigationDelegate, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + 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. - func didFinishNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) { + func didFinishNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + url urlArg: String?, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3621,8 +4206,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFinishNavigation" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFinishNavigation" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, urlArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3640,7 +4227,10 @@ withIdentifier: pigeonIdentifierArg) } /// Tells the delegate that navigation from the main frame has started. - func didStartProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, url urlArg: String?, completion: @escaping (Result) -> Void) { + func didStartProvisionalNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + url urlArg: String?, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3651,8 +4241,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didStartProvisionalNavigation" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didStartProvisionalNavigation" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, urlArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3671,7 +4263,11 @@ withIdentifier: pigeonIdentifierArg) /// Asks the delegate for permission to navigate to new content based on the /// specified action information. - func decidePolicyForNavigationAction(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) { + func decidePolicyForNavigationAction( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + navigationAction navigationActionArg: WKNavigationAction, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3682,9 +4278,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, navigationActionArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationAction" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, navigationActionArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -3695,7 +4294,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! NavigationActionPolicy completion(.success(result)) @@ -3705,7 +4308,11 @@ withIdentifier: pigeonIdentifierArg) /// Asks the delegate for permission to navigate to new content after the /// response to the navigation request is known. - func decidePolicyForNavigationResponse(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, navigationResponse navigationResponseArg: WKNavigationResponse, completion: @escaping (Result) -> Void) { + func decidePolicyForNavigationResponse( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + navigationResponse navigationResponseArg: WKNavigationResponse, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3716,9 +4323,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, navigationResponseArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.decidePolicyForNavigationResponse" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, navigationResponseArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -3729,7 +4339,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! NavigationResponsePolicy completion(.success(result)) @@ -3738,7 +4352,10 @@ withIdentifier: pigeonIdentifierArg) } /// Tells the delegate that an error occurred during navigation. - func didFailNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) { + func didFailNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + error errorArg: NSError, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3749,8 +4366,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailNavigation" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailNavigation" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3769,7 +4388,10 @@ withIdentifier: pigeonIdentifierArg) /// Tells the delegate that an error occurred during the early navigation /// process. - func didFailProvisionalNavigation(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, error errorArg: NSError, completion: @escaping (Result) -> Void) { + func didFailProvisionalNavigation( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + error errorArg: NSError, completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3780,8 +4402,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailProvisionalNavigation" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didFailProvisionalNavigation" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, errorArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3799,7 +4423,10 @@ withIdentifier: pigeonIdentifierArg) } /// Tells the delegate that the web view’s content process was terminated. - func webViewWebContentProcessDidTerminate(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, completion: @escaping (Result) -> Void) { + func webViewWebContentProcessDidTerminate( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3810,8 +4437,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.webViewWebContentProcessDidTerminate" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.webViewWebContentProcessDidTerminate" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3829,7 +4458,11 @@ withIdentifier: pigeonIdentifierArg) } /// Asks the delegate to respond to an authentication challenge. - func didReceiveAuthenticationChallenge(pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping (Result) -> Void) { + func didReceiveAuthenticationChallenge( + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + challenge challengeArg: URLAuthenticationChallenge, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3840,8 +4473,10 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKNavigationDelegate.didReceiveAuthenticationChallenge" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonInstanceArg, webViewArg, challengeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -3853,7 +4488,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! AuthenticationChallengeResponse completion(.success(result)) @@ -3866,41 +4505,52 @@ protocol PigeonApiDelegateNSObject { func pigeonDefaultConstructor(pigeonApi: PigeonApiNSObject) throws -> NSObject /// Registers the observer object to receive KVO notifications for the key /// path relative to the object receiving this message. - func addObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, options: [KeyValueObservingOptions]) throws + func addObserver( + pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String, + options: [KeyValueObservingOptions]) throws /// Stops the observer object from receiving change notifications for the /// property specified by the key path relative to the object receiving this /// message. - func removeObserver(pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) throws + func removeObserver( + pigeonApi: PigeonApiNSObject, pigeonInstance: NSObject, observer: NSObject, keyPath: String) + throws } protocol PigeonApiProtocolNSObject { /// Informs the observing object when the value at the specified key path /// relative to the observed object has changed. - func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) + func observeValue( + pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, + object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, + completion: @escaping (Result) -> Void) } -final class PigeonApiNSObject: PigeonApiProtocolNSObject { +final class PigeonApiNSObject: PigeonApiProtocolNSObject { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSObject init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSObject) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSObject?) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSObject?) + { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3909,7 +4559,9 @@ withIdentifier: pigeonIdentifierArg) } else { pigeonDefaultConstructorChannel.setMessageHandler(nil) } - let addObserverChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.addObserver", binaryMessenger: binaryMessenger, codec: codec) + let addObserverChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.addObserver", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { addObserverChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3918,7 +4570,9 @@ withIdentifier: pigeonIdentifierArg) let keyPathArg = args[2] as! String let optionsArg = args[3] as! [KeyValueObservingOptions] do { - try api.pigeonDelegate.addObserver(pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, keyPath: keyPathArg, options: optionsArg) + try api.pigeonDelegate.addObserver( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, + keyPath: keyPathArg, options: optionsArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3927,7 +4581,9 @@ withIdentifier: pigeonIdentifierArg) } else { addObserverChannel.setMessageHandler(nil) } - let removeObserverChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.removeObserver", binaryMessenger: binaryMessenger, codec: codec) + let removeObserverChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.removeObserver", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { removeObserverChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -3935,7 +4591,9 @@ withIdentifier: pigeonIdentifierArg) let observerArg = args[1] as! NSObject let keyPathArg = args[2] as! String do { - try api.pigeonDelegate.removeObserver(pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, keyPath: keyPathArg) + try api.pigeonDelegate.removeObserver( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, observer: observerArg, + keyPath: keyPathArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -3947,21 +4605,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of NSObject and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: NSObject, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: NSObject, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -3980,7 +4643,11 @@ withIdentifier: pigeonIdentifierArg) } /// Informs the observing object when the value at the specified key path /// relative to the observed object has changed. - func observeValue(pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, completion: @escaping (Result) -> Void) { + func observeValue( + pigeonInstance pigeonInstanceArg: NSObject, keyPath keyPathArg: String?, + object objectArg: NSObject?, change changeArg: [KeyValueChangeKey: Any?]?, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -3992,8 +4659,10 @@ withIdentifier: pigeonIdentifierArg) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.NSObject.observeValue" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] as [Any?]) { response in + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, keyPathArg, objectArg, changeArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -4012,111 +4681,133 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateUIViewWKWebView { #if !os(macOS) - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView + func pigeonDefaultConstructor( + pigeonApi: PigeonApiUIViewWKWebView, initialConfiguration: WKWebViewConfiguration + ) throws -> WKWebView #endif #if !os(macOS) - /// The object that contains the configuration details for the web view. - func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> WKWebViewConfiguration + /// The object that contains the configuration details for the web view. + func configuration(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + -> WKWebViewConfiguration #endif #if !os(macOS) - /// The scroll view associated with the web view. - func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> UIScrollView + /// The scroll view associated with the web view. + func scrollView(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + -> UIScrollView #endif #if !os(macOS) - /// The object you use to integrate custom user interface elements, such as - /// contextual menus or panels, into web view interactions. - func setUIDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws + /// The object you use to integrate custom user interface elements, such as + /// contextual menus or panels, into web view interactions. + func setUIDelegate( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws #endif #if !os(macOS) - /// The object you use to manage navigation behavior for the web view. - func setNavigationDelegate(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws + /// The object you use to manage navigation behavior for the web view. + func setNavigationDelegate( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate + ) throws #endif #if !os(macOS) - /// The URL for the current webpage. - func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The URL for the current webpage. + func getUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// An estimate of what fraction of the current navigation has been loaded. - func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Double + /// An estimate of what fraction of the current navigation has been loaded. + func getEstimatedProgress(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + -> Double #endif #if !os(macOS) - /// Loads the web content that the specified URL request object references and - /// navigates to that content. - func load(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws + /// Loads the web content that the specified URL request object references and + /// navigates to that content. + func load( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) + throws #endif #if !os(macOS) - /// Loads the contents of the specified HTML string and navigates to it. - func loadHtmlString(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws + /// Loads the contents of the specified HTML string and navigates to it. + func loadHtmlString( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, string: String, + baseUrl: String?) throws #endif #if !os(macOS) - /// Loads the web content from the specified file and navigates to it. - func loadFileUrl(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws + /// Loads the web content from the specified file and navigates to it. + func loadFileUrl( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, url: String, + readAccessUrl: String) throws #endif #if !os(macOS) - /// Convenience method to load a Flutter asset. - func loadFlutterAsset(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws + /// Convenience method to load a Flutter asset. + func loadFlutterAsset( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, key: String) throws #endif #if !os(macOS) - /// A Boolean value that indicates whether there is a valid back item in the - /// back-forward list. - func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid back item in the + /// back-forward list. + func canGoBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(macOS) - /// A Boolean value that indicates whether there is a valid forward item in - /// the back-forward list. - func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid forward item in + /// the back-forward list. + func canGoForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(macOS) - /// Navigates to the back item in the back-forward list. - func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the back item in the back-forward list. + func goBack(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// Navigates to the forward item in the back-forward list. - func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the forward item in the back-forward list. + func goForward(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// Reloads the current webpage. - func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + /// Reloads the current webpage. + func reload(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(macOS) - /// The page title. - func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The page title. + func getTitle(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(macOS) - /// A Boolean value that indicates whether horizontal swipe gestures trigger - /// backward and forward page navigation. - func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// A Boolean value that indicates whether horizontal swipe gestures trigger + /// backward and forward page navigation. + func setAllowsBackForwardNavigationGestures( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif #if !os(macOS) - /// The custom user agent string. - func setCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws + /// The custom user agent string. + func setCustomUserAgent( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws #endif #if !os(macOS) - /// Evaluates the specified JavaScript string. - func evaluateJavaScript(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) + /// Evaluates the specified JavaScript string. + func evaluateJavaScript( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, + completion: @escaping (Result) -> Void) #endif #if !os(macOS) - /// A Boolean value that indicates whether you can inspect the view with - /// Safari Web Inspector. - func setInspectable(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws + /// A Boolean value that indicates whether you can inspect the view with + /// Safari Web Inspector. + func setInspectable( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws #endif #if !os(macOS) - /// The custom user agent string. - func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The custom user agent string. + func getCustomUserAgent(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView) throws + -> String? #endif #if !os(macOS) - /// Whether to allow previews for link destinations and detected data such as - /// addresses and phone numbers. - /// - /// Defaults to true. - func setAllowsLinkPreview(pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview( + pigeonApi: PigeonApiUIViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif } protocol PigeonApiProtocolUIViewWKWebView { } -final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { +final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIViewWKWebView ///An implementation of [UIView] used to access callback methods @@ -4129,567 +4820,673 @@ final class PigeonApiUIViewWKWebView: PigeonApiProtocolUIViewWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiWKWebView(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIViewWKWebView) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateUIViewWKWebView + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewWKWebView?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIViewWKWebView? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let initialConfigurationArg = args[1] as! WKWebViewConfiguration - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: initialConfigurationArg), -withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + let initialConfigurationArg = args[1] as! WKWebViewConfiguration + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, initialConfiguration: initialConfigurationArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let configurationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.configuration", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - configurationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let configurationChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.configuration", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + configurationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.configuration( + pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + configurationChannel.setMessageHandler(nil) } - } else { - configurationChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let scrollViewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.scrollView", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - scrollViewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let scrollViewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.scrollView", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + scrollViewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.scrollView(pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + scrollViewChannel.setMessageHandler(nil) } - } else { - scrollViewChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setUIDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setUIDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setUIDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKUIDelegate - do { - try api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setUIDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setUIDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setUIDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKUIDelegate + do { + try api.pigeonDelegate.setUIDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setUIDelegateChannel.setMessageHandler(nil) } - } else { - setUIDelegateChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setNavigationDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setNavigationDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setNavigationDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKNavigationDelegate - do { - try api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setNavigationDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setNavigationDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setNavigationDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKNavigationDelegate + do { + try api.pigeonDelegate.setNavigationDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setNavigationDelegateChannel.setMessageHandler(nil) } - } else { - setNavigationDelegateChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getUrl", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getUrlChannel.setMessageHandler(nil) } - } else { - getUrlChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let getEstimatedProgressChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getEstimatedProgress", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getEstimatedProgressChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getEstimatedProgressChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getEstimatedProgress", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEstimatedProgressChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getEstimatedProgress( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getEstimatedProgressChannel.setMessageHandler(nil) } - } else { - getEstimatedProgressChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let loadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.load", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let requestArg = args[1] as! URLRequestWrapper - do { - try api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.load", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let requestArg = args[1] as! URLRequestWrapper + do { + try api.pigeonDelegate.load( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadChannel.setMessageHandler(nil) } - } else { - loadChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let loadHtmlStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadHtmlString", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadHtmlStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let stringArg = args[1] as! String - let baseUrlArg: String? = nilOrValue(args[2]) - do { - try api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, baseUrl: baseUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadHtmlStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadHtmlString", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadHtmlStringChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let stringArg = args[1] as! String + let baseUrlArg: String? = nilOrValue(args[2]) + do { + try api.pigeonDelegate.loadHtmlString( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, + baseUrl: baseUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadHtmlStringChannel.setMessageHandler(nil) } - } else { - loadHtmlStringChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let loadFileUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFileUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFileUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let urlArg = args[1] as! String - let readAccessUrlArg = args[2] as! String - do { - try api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, readAccessUrl: readAccessUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadFileUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFileUrl", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFileUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let urlArg = args[1] as! String + let readAccessUrlArg = args[2] as! String + do { + try api.pigeonDelegate.loadFileUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, + readAccessUrl: readAccessUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadFileUrlChannel.setMessageHandler(nil) } - } else { - loadFileUrlChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let loadFlutterAssetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFlutterAsset", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFlutterAssetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let keyArg = args[1] as! String - do { - try api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadFlutterAssetChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.loadFlutterAsset", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFlutterAssetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let keyArg = args[1] as! String + do { + try api.pigeonDelegate.loadFlutterAsset( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadFlutterAssetChannel.setMessageHandler(nil) } - } else { - loadFlutterAssetChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let canGoBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoBack", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let canGoBackChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoBack", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoBack( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + canGoBackChannel.setMessageHandler(nil) } - } else { - canGoBackChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let canGoForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoForward", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let canGoForwardChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.canGoForward", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoForward( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + canGoForwardChannel.setMessageHandler(nil) } - } else { - canGoForwardChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let goBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goBack", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let goBackChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goBack", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + goBackChannel.setMessageHandler(nil) } - } else { - goBackChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let goForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goForward", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let goForwardChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.goForward", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + goForwardChannel.setMessageHandler(nil) } - } else { - goForwardChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.reload", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - reloadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let reloadChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.reload", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + reloadChannel.setMessageHandler(nil) } - } else { - reloadChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let getTitleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getTitle", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getTitleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getTitleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getTitle", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getTitleChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getTitle( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getTitleChannel.setMessageHandler(nil) } - } else { - getTitleChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsBackForwardNavigationGestures", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsBackForwardNavigationGestures", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsBackForwardNavigationGestures( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) } - } else { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let userAgentArg: String? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setCustomUserAgentChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setCustomUserAgent", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let userAgentArg: String? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setCustomUserAgent( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setCustomUserAgentChannel.setMessageHandler(nil) } - } else { - setCustomUserAgentChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let evaluateJavaScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.evaluateJavaScript", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - evaluateJavaScriptChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let javaScriptStringArg = args[1] as! String - api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + let evaluateJavaScriptChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.evaluateJavaScript", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + evaluateJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let javaScriptStringArg = args[1] as! String + api.pigeonDelegate.evaluateJavaScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg + ) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } } } + } else { + evaluateJavaScriptChannel.setMessageHandler(nil) } - } else { - evaluateJavaScriptChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setInspectableChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setInspectable", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setInspectableChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let inspectableArg = args[1] as! Bool - do { - try api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setInspectableChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setInspectable", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setInspectableChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let inspectableArg = args[1] as! Bool + do { + try api.pigeonDelegate.setInspectable( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setInspectableChannel.setMessageHandler(nil) } - } else { - setInspectableChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let getCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getCustomUserAgentChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.getCustomUserAgent", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getCustomUserAgent( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) - } #endif #if !os(macOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIViewWKWebView.setAllowsLinkPreview", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) - } #endif } #if !os(macOS) - ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + ///Creates a Dart instance of UIViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: WKWebView, 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.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(())) + } } } } - } #endif } protocol PigeonApiDelegateNSViewWKWebView { #if !os(iOS) - func pigeonDefaultConstructor(pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration) throws -> WKWebView + func pigeonDefaultConstructor( + pigeonApi: PigeonApiNSViewWKWebView, initialConfiguration: WKWebViewConfiguration + ) throws -> WKWebView #endif #if !os(iOS) - /// The object that contains the configuration details for the web view. - func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> WKWebViewConfiguration + /// The object that contains the configuration details for the web view. + func configuration(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + -> WKWebViewConfiguration #endif #if !os(iOS) - /// The object you use to integrate custom user interface elements, such as - /// contextual menus or panels, into web view interactions. - func setUIDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws + /// The object you use to integrate custom user interface elements, such as + /// contextual menus or panels, into web view interactions. + func setUIDelegate( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKUIDelegate) throws #endif #if !os(iOS) - /// The object you use to manage navigation behavior for the web view. - func setNavigationDelegate(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate) throws + /// The object you use to manage navigation behavior for the web view. + func setNavigationDelegate( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, delegate: WKNavigationDelegate + ) throws #endif #if !os(iOS) - /// The URL for the current webpage. - func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The URL for the current webpage. + func getUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// An estimate of what fraction of the current navigation has been loaded. - func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Double + /// An estimate of what fraction of the current navigation has been loaded. + func getEstimatedProgress(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + -> Double #endif #if !os(iOS) - /// Loads the web content that the specified URL request object references and - /// navigates to that content. - func load(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) throws + /// Loads the web content that the specified URL request object references and + /// navigates to that content. + func load( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, request: URLRequestWrapper) + throws #endif #if !os(iOS) - /// Loads the contents of the specified HTML string and navigates to it. - func loadHtmlString(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, baseUrl: String?) throws + /// Loads the contents of the specified HTML string and navigates to it. + func loadHtmlString( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, string: String, + baseUrl: String?) throws #endif #if !os(iOS) - /// Loads the web content from the specified file and navigates to it. - func loadFileUrl(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, readAccessUrl: String) throws + /// Loads the web content from the specified file and navigates to it. + func loadFileUrl( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, url: String, + readAccessUrl: String) throws #endif #if !os(iOS) - /// Convenience method to load a Flutter asset. - func loadFlutterAsset(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws + /// Convenience method to load a Flutter asset. + func loadFlutterAsset( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, key: String) throws #endif #if !os(iOS) - /// A Boolean value that indicates whether there is a valid back item in the - /// back-forward list. - func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid back item in the + /// back-forward list. + func canGoBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(iOS) - /// A Boolean value that indicates whether there is a valid forward item in - /// the back-forward list. - func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool + /// A Boolean value that indicates whether there is a valid forward item in + /// the back-forward list. + func canGoForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> Bool #endif #if !os(iOS) - /// Navigates to the back item in the back-forward list. - func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the back item in the back-forward list. + func goBack(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// Navigates to the forward item in the back-forward list. - func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Navigates to the forward item in the back-forward list. + func goForward(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// Reloads the current webpage. - func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + /// Reloads the current webpage. + func reload(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws #endif #if !os(iOS) - /// The page title. - func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The page title. + func getTitle(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? #endif #if !os(iOS) - /// A Boolean value that indicates whether horizontal swipe gestures trigger - /// backward and forward page navigation. - func setAllowsBackForwardNavigationGestures(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// A Boolean value that indicates whether horizontal swipe gestures trigger + /// backward and forward page navigation. + func setAllowsBackForwardNavigationGestures( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif #if !os(iOS) - /// The custom user agent string. - func setCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws + /// The custom user agent string. + func setCustomUserAgent( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, userAgent: String?) throws #endif #if !os(iOS) - /// Evaluates the specified JavaScript string. - func evaluateJavaScript(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, completion: @escaping (Result) -> Void) + /// Evaluates the specified JavaScript string. + func evaluateJavaScript( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, javaScriptString: String, + completion: @escaping (Result) -> Void) #endif #if !os(iOS) - /// A Boolean value that indicates whether you can inspect the view with - /// Safari Web Inspector. - func setInspectable(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws + /// A Boolean value that indicates whether you can inspect the view with + /// Safari Web Inspector. + func setInspectable( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, inspectable: Bool) throws #endif #if !os(iOS) - /// The custom user agent string. - func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws -> String? + /// The custom user agent string. + func getCustomUserAgent(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView) throws + -> String? #endif #if !os(iOS) - /// Whether to allow previews for link destinations and detected data such as - /// addresses and phone numbers. - /// - /// Defaults to true. - func setAllowsLinkPreview(pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws + /// Whether to allow previews for link destinations and detected data such as + /// addresses and phone numbers. + /// + /// Defaults to true. + func setAllowsLinkPreview( + pigeonApi: PigeonApiNSViewWKWebView, pigeonInstance: WKWebView, allow: Bool) throws #endif } protocol PigeonApiProtocolNSViewWKWebView { } -final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { +final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateNSViewWKWebView ///An implementation of [NSObject] used to access callback methods @@ -4702,444 +5499,525 @@ final class PigeonApiNSViewWKWebView: PigeonApiProtocolNSViewWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiWKWebView(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateNSViewWKWebView) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateNSViewWKWebView + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSViewWKWebView?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiNSViewWKWebView? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(iOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - let initialConfigurationArg = args[1] as! WKWebViewConfiguration - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api, initialConfiguration: initialConfigurationArg), -withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + let initialConfigurationArg = args[1] as! WKWebViewConfiguration + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.pigeonDefaultConstructor( + pigeonApi: api, initialConfiguration: initialConfigurationArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let configurationChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.configuration", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - configurationChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let pigeonIdentifierArg = args[1] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance(try api.pigeonDelegate.configuration(pigeonApi: api, pigeonInstance: pigeonInstanceArg), withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let configurationChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.configuration", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + configurationChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let pigeonIdentifierArg = args[1] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.configuration( + pigeonApi: api, pigeonInstance: pigeonInstanceArg), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + configurationChannel.setMessageHandler(nil) } - } else { - configurationChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setUIDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setUIDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setUIDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKUIDelegate - do { - try api.pigeonDelegate.setUIDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setUIDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setUIDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setUIDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKUIDelegate + do { + try api.pigeonDelegate.setUIDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setUIDelegateChannel.setMessageHandler(nil) } - } else { - setUIDelegateChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setNavigationDelegateChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setNavigationDelegate", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setNavigationDelegateChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let delegateArg = args[1] as! WKNavigationDelegate - do { - try api.pigeonDelegate.setNavigationDelegate(pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setNavigationDelegateChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setNavigationDelegate", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setNavigationDelegateChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let delegateArg = args[1] as! WKNavigationDelegate + do { + try api.pigeonDelegate.setNavigationDelegate( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, delegate: delegateArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setNavigationDelegateChannel.setMessageHandler(nil) } - } else { - setNavigationDelegateChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let getUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getUrl", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getUrlChannel.setMessageHandler(nil) } - } else { - getUrlChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let getEstimatedProgressChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getEstimatedProgress", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getEstimatedProgressChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getEstimatedProgress(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getEstimatedProgressChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getEstimatedProgress", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getEstimatedProgressChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getEstimatedProgress( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getEstimatedProgressChannel.setMessageHandler(nil) } - } else { - getEstimatedProgressChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let loadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.load", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let requestArg = args[1] as! URLRequestWrapper - do { - try api.pigeonDelegate.load(pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.load", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let requestArg = args[1] as! URLRequestWrapper + do { + try api.pigeonDelegate.load( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, request: requestArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadChannel.setMessageHandler(nil) } - } else { - loadChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let loadHtmlStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadHtmlString", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadHtmlStringChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let stringArg = args[1] as! String - let baseUrlArg: String? = nilOrValue(args[2]) - do { - try api.pigeonDelegate.loadHtmlString(pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, baseUrl: baseUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadHtmlStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadHtmlString", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadHtmlStringChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let stringArg = args[1] as! String + let baseUrlArg: String? = nilOrValue(args[2]) + do { + try api.pigeonDelegate.loadHtmlString( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, string: stringArg, + baseUrl: baseUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadHtmlStringChannel.setMessageHandler(nil) } - } else { - loadHtmlStringChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let loadFileUrlChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFileUrl", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFileUrlChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let urlArg = args[1] as! String - let readAccessUrlArg = args[2] as! String - do { - try api.pigeonDelegate.loadFileUrl(pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, readAccessUrl: readAccessUrlArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadFileUrlChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFileUrl", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFileUrlChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let urlArg = args[1] as! String + let readAccessUrlArg = args[2] as! String + do { + try api.pigeonDelegate.loadFileUrl( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, url: urlArg, + readAccessUrl: readAccessUrlArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadFileUrlChannel.setMessageHandler(nil) } - } else { - loadFileUrlChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let loadFlutterAssetChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFlutterAsset", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - loadFlutterAssetChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let keyArg = args[1] as! String - do { - try api.pigeonDelegate.loadFlutterAsset(pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let loadFlutterAssetChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.loadFlutterAsset", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + loadFlutterAssetChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let keyArg = args[1] as! String + do { + try api.pigeonDelegate.loadFlutterAsset( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, key: keyArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + loadFlutterAssetChannel.setMessageHandler(nil) } - } else { - loadFlutterAssetChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let canGoBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoBack", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let canGoBackChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoBack", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoBack( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + canGoBackChannel.setMessageHandler(nil) } - } else { - canGoBackChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let canGoForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoForward", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - canGoForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.canGoForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let canGoForwardChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.canGoForward", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + canGoForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.canGoForward( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + canGoForwardChannel.setMessageHandler(nil) } - } else { - canGoForwardChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let goBackChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goBack", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goBackChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let goBackChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goBack", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goBackChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goBack(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + goBackChannel.setMessageHandler(nil) } - } else { - goBackChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let goForwardChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goForward", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - goForwardChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let goForwardChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.goForward", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + goForwardChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.goForward(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + goForwardChannel.setMessageHandler(nil) } - } else { - goForwardChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let reloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.reload", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - reloadChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let reloadChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.reload", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + reloadChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + try api.pigeonDelegate.reload(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + reloadChannel.setMessageHandler(nil) } - } else { - reloadChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let getTitleChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getTitle", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getTitleChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getTitle(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getTitleChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getTitle", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getTitleChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getTitle( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getTitleChannel.setMessageHandler(nil) } - } else { - getTitleChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsBackForwardNavigationGestures", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsBackForwardNavigationGestures(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAllowsBackForwardNavigationGesturesChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsBackForwardNavigationGestures", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsBackForwardNavigationGestures( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) } - } else { - setAllowsBackForwardNavigationGesturesChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let userAgentArg: String? = nilOrValue(args[1]) - do { - try api.pigeonDelegate.setCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setCustomUserAgentChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setCustomUserAgent", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let userAgentArg: String? = nilOrValue(args[1]) + do { + try api.pigeonDelegate.setCustomUserAgent( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, userAgent: userAgentArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setCustomUserAgentChannel.setMessageHandler(nil) } - } else { - setCustomUserAgentChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let evaluateJavaScriptChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.evaluateJavaScript", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - evaluateJavaScriptChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let javaScriptStringArg = args[1] as! String - api.pigeonDelegate.evaluateJavaScript(pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg) { result in - switch result { - case .success(let res): - reply(wrapResult(res)) - case .failure(let error): - reply(wrapError(error)) + let evaluateJavaScriptChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.evaluateJavaScript", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + evaluateJavaScriptChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let javaScriptStringArg = args[1] as! String + api.pigeonDelegate.evaluateJavaScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, javaScriptString: javaScriptStringArg + ) { result in + switch result { + case .success(let res): + reply(wrapResult(res)) + case .failure(let error): + reply(wrapError(error)) + } } } + } else { + evaluateJavaScriptChannel.setMessageHandler(nil) } - } else { - evaluateJavaScriptChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setInspectableChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setInspectable", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setInspectableChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let inspectableArg = args[1] as! Bool - do { - try api.pigeonDelegate.setInspectable(pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setInspectableChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setInspectable", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setInspectableChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let inspectableArg = args[1] as! Bool + do { + try api.pigeonDelegate.setInspectable( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, inspectable: inspectableArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setInspectableChannel.setMessageHandler(nil) } - } else { - setInspectableChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let getCustomUserAgentChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getCustomUserAgent", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - getCustomUserAgentChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - do { - let result = try api.pigeonDelegate.getCustomUserAgent(pigeonApi: api, pigeonInstance: pigeonInstanceArg) - reply(wrapResult(result)) - } catch { - reply(wrapError(error)) + let getCustomUserAgentChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.getCustomUserAgent", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + getCustomUserAgentChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + do { + let result = try api.pigeonDelegate.getCustomUserAgent( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) + reply(wrapResult(result)) + } catch { + reply(wrapError(error)) + } } + } else { + getCustomUserAgentChannel.setMessageHandler(nil) } - } else { - getCustomUserAgentChannel.setMessageHandler(nil) - } #endif #if !os(iOS) - let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - setAllowsLinkPreviewChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonInstanceArg = args[0] as! WKWebView - let allowArg = args[1] as! Bool - do { - try api.pigeonDelegate.setAllowsLinkPreview(pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let setAllowsLinkPreviewChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.NSViewWKWebView.setAllowsLinkPreview", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + setAllowsLinkPreviewChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonInstanceArg = args[0] as! WKWebView + let allowArg = args[1] as! Bool + do { + try api.pigeonDelegate.setAllowsLinkPreview( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + setAllowsLinkPreviewChannel.setMessageHandler(nil) } - } else { - setAllowsLinkPreviewChannel.setMessageHandler(nil) - } #endif } #if !os(iOS) - ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, 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.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(())) + ///Creates a Dart instance of NSViewWKWebView and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: WKWebView, 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.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(())) + } } } } - } #endif } open class PigeonApiDelegateWKWebView { @@ -5148,7 +6026,7 @@ open class PigeonApiDelegateWKWebView { protocol PigeonApiProtocolWKWebView { } -final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { +final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebView ///An implementation of [NSObject] used to access callback methods @@ -5156,26 +6034,32 @@ final class PigeonApiWKWebView: PigeonApiProtocolWKWebView { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebView) { + init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebView) + { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of WKWebView and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKWebView, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKWebView, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5199,19 +6083,35 @@ protocol PigeonApiDelegateWKUIDelegate { protocol PigeonApiProtocolWKUIDelegate { /// Creates a new web view. - func onCreateWebView(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, configuration configurationArg: WKWebViewConfiguration, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) + func onCreateWebView( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + configuration configurationArg: WKWebViewConfiguration, + navigationAction navigationActionArg: WKNavigationAction, + completion: @escaping (Result) -> Void) /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. - func requestMediaCapturePermission(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, completion: @escaping (Result) -> Void) + func requestMediaCapturePermission( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, + completion: @escaping (Result) -> Void) /// Displays a JavaScript alert panel. - func runJavaScriptAlertPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) + func runJavaScriptAlertPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + message messageArg: String, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void) /// Displays a JavaScript confirm panel. - func runJavaScriptConfirmPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) + func runJavaScriptConfirmPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + message messageArg: String, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void) /// Displays a JavaScript text input panel. - func runJavaScriptTextInputPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) + func runJavaScriptTextInputPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void) } -final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { +final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKUIDelegate ///An implementation of [NSObject] used to access callback methods @@ -5219,25 +6119,32 @@ final class PigeonApiWKUIDelegate: PigeonApiProtocolWKUIDelegate { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUIDelegate) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKUIDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUIDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKUIDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { pigeonDefaultConstructorChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonIdentifierArg = args[0] as! Int64 do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -5249,25 +6156,34 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of WKUIDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKUIDelegate, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKUIDelegate, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { + } 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: ""))) + 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. - func onCreateWebView(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, configuration configurationArg: WKWebViewConfiguration, navigationAction navigationActionArg: WKNavigationAction, completion: @escaping (Result) -> Void) { + func onCreateWebView( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + configuration configurationArg: WKWebViewConfiguration, + navigationAction navigationActionArg: WKNavigationAction, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5278,9 +6194,13 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.onCreateWebView" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, configurationArg, navigationActionArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.onCreateWebView" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [pigeonInstanceArg, webViewArg, configurationArg, navigationActionArg] as [Any?] + ) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5298,7 +6218,11 @@ withIdentifier: pigeonIdentifierArg) /// Determines whether a web resource, which the security origin object /// describes, can access to the device’s microphone audio and camera video. - func requestMediaCapturePermission(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, completion: @escaping (Result) -> Void) { + func requestMediaCapturePermission( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + origin originArg: WKSecurityOrigin, frame frameArg: WKFrameInfo, type typeArg: MediaCaptureType, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5309,9 +6233,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, originArg, frameArg, typeArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.requestMediaCapturePermission" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, originArg, frameArg, typeArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5322,7 +6249,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! PermissionDecision completion(.success(result)) @@ -5331,7 +6262,11 @@ withIdentifier: pigeonIdentifierArg) } /// Displays a JavaScript alert panel. - func runJavaScriptAlertPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { + func runJavaScriptAlertPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + message messageArg: String, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5342,9 +6277,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptAlertPanel" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptAlertPanel" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5361,7 +6299,11 @@ withIdentifier: pigeonIdentifierArg) } /// Displays a JavaScript confirm panel. - func runJavaScriptConfirmPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, message messageArg: String, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { + func runJavaScriptConfirmPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + message messageArg: String, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5372,9 +6314,12 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptConfirmPanel" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, webViewArg, messageArg, frameArg] as [Any?]) { + response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5385,7 +6330,11 @@ withIdentifier: pigeonIdentifierArg) let details: String? = nilOrValue(listResponse[2]) completion(.failure(PigeonError(code: code, message: message, details: details))) } else if listResponse[0] == nil { - completion(.failure(PigeonError(code: "null-error", message: "Flutter api returned null value for non-null return value.", details: ""))) + completion( + .failure( + PigeonError( + code: "null-error", + message: "Flutter api returned null value for non-null return value.", details: ""))) } else { let result = listResponse[0] as! Bool completion(.success(result)) @@ -5394,7 +6343,11 @@ withIdentifier: pigeonIdentifierArg) } /// Displays a JavaScript text input panel. - func runJavaScriptTextInputPanel(pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, completion: @escaping (Result) -> Void) { + func runJavaScriptTextInputPanel( + pigeonInstance pigeonInstanceArg: WKUIDelegate, webView webViewArg: WKWebView, + prompt promptArg: String, defaultText defaultTextArg: String?, frame frameArg: WKFrameInfo, + completion: @escaping (Result) -> Void + ) { if pigeonRegistrar.ignoreCallsToDart { completion( .failure( @@ -5405,9 +6358,13 @@ withIdentifier: pigeonIdentifierArg) } let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptTextInputPanel" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, webViewArg, promptArg, defaultTextArg, frameArg] as [Any?]) { response in + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.WKUIDelegate.runJavaScriptTextInputPanel" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage( + [pigeonInstanceArg, webViewArg, promptArg, defaultTextArg, frameArg] as [Any?] + ) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5428,13 +6385,15 @@ withIdentifier: pigeonIdentifierArg) protocol PigeonApiDelegateWKHTTPCookieStore { /// Sets a cookie policy that indicates whether the cookie store allows cookie /// storage. - func setCookie(pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, completion: @escaping (Result) -> Void) + func setCookie( + pigeonApi: PigeonApiWKHTTPCookieStore, pigeonInstance: WKHTTPCookieStore, cookie: HTTPCookie, + completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolWKHTTPCookieStore { } -final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { +final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKHTTPCookieStore ///An implementation of [NSObject] used to access callback methods @@ -5442,23 +6401,33 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKHTTPCookieStore) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKHTTPCookieStore + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKHTTPCookieStore?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKHTTPCookieStore? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let setCookieChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.setCookie", binaryMessenger: binaryMessenger, codec: codec) + let setCookieChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKHTTPCookieStore.setCookie", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setCookieChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! WKHTTPCookieStore let cookieArg = args[1] as! HTTPCookie - api.pigeonDelegate.setCookie(pigeonApi: api, pigeonInstance: pigeonInstanceArg, cookie: cookieArg) { result in + api.pigeonDelegate.setCookie( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, cookie: cookieArg + ) { result in switch result { case .success: reply(wrapResult(nil)) @@ -5473,21 +6442,26 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } ///Creates a Dart instance of WKHTTPCookieStore and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: WKHTTPCookieStore, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: WKHTTPCookieStore, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5507,22 +6481,27 @@ final class PigeonApiWKHTTPCookieStore: PigeonApiProtocolWKHTTPCookieStore { } protocol PigeonApiDelegateUIScrollViewDelegate { #if !os(macOS) - func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws -> UIScrollViewDelegate + func pigeonDefaultConstructor(pigeonApi: PigeonApiUIScrollViewDelegate) throws + -> UIScrollViewDelegate #endif } protocol PigeonApiProtocolUIScrollViewDelegate { #if !os(macOS) - /// Tells the delegate when the user scrolls the content view within the - /// scroll view. - /// - /// Note that this is a convenient method that includes the `contentOffset` of - /// the `scrollView`. - func scrollViewDidScroll(pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, completion: @escaping (Result) -> Void) #endif + /// Tells the delegate when the user scrolls the content view within the + /// scroll view. + /// + /// Note that this is a convenient method that includes the `contentOffset` of + /// the `scrollView`. + func scrollViewDidScroll( + pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, + scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, + completion: @escaping (Result) -> Void) + #endif } -final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate { +final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateUIScrollViewDelegate ///An implementation of [NSObject] used to access callback methods @@ -5530,55 +6509,112 @@ final class PigeonApiUIScrollViewDelegate: PigeonApiProtocolUIScrollViewDelegate return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateUIScrollViewDelegate) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateUIScrollViewDelegate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollViewDelegate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiUIScrollViewDelegate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() #if !os(macOS) - let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_defaultConstructor", binaryMessenger: binaryMessenger, codec: codec) - if let api = api { - pigeonDefaultConstructorChannel.setMessageHandler { message, reply in - let args = message as! [Any?] - let pigeonIdentifierArg = args[0] as! Int64 - do { - api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), -withIdentifier: pigeonIdentifierArg) - reply(wrapResult(nil)) - } catch { - reply(wrapError(error)) + let pigeonDefaultConstructorChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.pigeon_defaultConstructor", + binaryMessenger: binaryMessenger, codec: codec) + if let api = api { + pigeonDefaultConstructorChannel.setMessageHandler { message, reply in + let args = message as! [Any?] + let pigeonIdentifierArg = args[0] as! Int64 + do { + api.pigeonRegistrar.instanceManager.addDartCreatedInstance( + try api.pigeonDelegate.pigeonDefaultConstructor(pigeonApi: api), + withIdentifier: pigeonIdentifierArg) + reply(wrapResult(nil)) + } catch { + reply(wrapError(error)) + } } + } else { + pigeonDefaultConstructorChannel.setMessageHandler(nil) } - } else { - pigeonDefaultConstructorChannel.setMessageHandler(nil) - } #endif } #if !os(macOS) - ///Creates a Dart instance of UIScrollViewDelegate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: UIScrollViewDelegate, 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) + ///Creates a Dart instance of UIScrollViewDelegate and attaches it to [pigeonInstance]. + func pigeonNewInstance( + pigeonInstance: UIScrollViewDelegate, + 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.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(())) + } + } + } + } + #endif + #if !os(macOS) + /// Tells the delegate when the user scrolls the content view within the + /// scroll view. + /// + /// Note that this is a convenient method that includes the `contentOffset` of + /// the `scrollView`. + func scrollViewDidScroll( + pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, + scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, + completion: @escaping (Result) -> Void + ) { + if pigeonRegistrar.ignoreCallsToDart { + completion( + .failure( + PigeonError( + code: "ignore-calls-error", + message: "Calls to Dart are being ignored.", details: ""))) + return + } 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 + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.scrollViewDidScroll" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) + channel.sendMessage([pigeonInstanceArg, scrollViewArg, xArg, yArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) return @@ -5593,69 +6629,41 @@ withIdentifier: pigeonIdentifierArg) } } } - } - #endif - #if !os(macOS) - /// Tells the delegate when the user scrolls the content view within the - /// scroll view. - /// - /// Note that this is a convenient method that includes the `contentOffset` of - /// the `scrollView`. - func scrollViewDidScroll(pigeonInstance pigeonInstanceArg: UIScrollViewDelegate, scrollView scrollViewArg: UIScrollView, x xArg: Double, y yArg: Double, completion: @escaping (Result) -> Void) { - if pigeonRegistrar.ignoreCallsToDart { - completion( - .failure( - PigeonError( - code: "ignore-calls-error", - message: "Calls to Dart are being ignored.", details: ""))) - return - } - let binaryMessenger = pigeonRegistrar.binaryMessenger - let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.UIScrollViewDelegate.scrollViewDidScroll" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) - channel.sendMessage([pigeonInstanceArg, scrollViewArg, xArg, yArg] 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(())) - } - } - } #endif } protocol PigeonApiDelegateURLCredential { /// Creates a URL credential instance for internet password authentication /// with a given user name and password, using a given persistence setting. - func withUser(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence) throws -> URLCredential + func withUser( + pigeonApi: PigeonApiURLCredential, user: String, password: String, + persistence: UrlCredentialPersistence + ) throws -> URLCredential /// Creates a URL credential instance for internet password authentication /// with a given user name and password, using a given persistence setting. /// /// This provides the native `UrlCredential(user:password:persistence)` /// constructor as an async method to ensure the class is added to the /// InstanceManager. See https://github.com/flutter/flutter/issues/162437. - func withUserAsync(pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence, completion: @escaping (Result) -> Void) + func withUserAsync( + pigeonApi: PigeonApiURLCredential, user: String, password: String, + persistence: UrlCredentialPersistence, + completion: @escaping (Result) -> Void) /// Creates a URL credential instance for server trust authentication, /// initialized with a accepted trust. /// /// This provides the native `UrlCredential(forTrust:)` constructor as an /// async method to ensure the class is added to the InstanceManager. See /// https://github.com/flutter/flutter/issues/162437. - func serverTrustAsync(pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) + func serverTrustAsync( + pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, + completion: @escaping (Result) -> Void) } protocol PigeonApiProtocolURLCredential { } -final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { +final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLCredential ///An implementation of [NSObject] used to access callback methods @@ -5663,17 +6671,24 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLCredential) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLCredential + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLCredential?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLCredential? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let withUserChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUser", binaryMessenger: binaryMessenger, codec: codec) + let withUserChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUser", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { withUserChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -5683,8 +6698,9 @@ final class PigeonApiURLCredential: PigeonApiProtocolURLCredential { let persistenceArg = args[3] as! UrlCredentialPersistence do { api.pigeonRegistrar.instanceManager.addDartCreatedInstance( -try api.pigeonDelegate.withUser(pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg), -withIdentifier: pigeonIdentifierArg) + try api.pigeonDelegate.withUser( + pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg), + withIdentifier: pigeonIdentifierArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -5693,14 +6709,18 @@ withIdentifier: pigeonIdentifierArg) } else { withUserChannel.setMessageHandler(nil) } - let withUserAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUserAsync", binaryMessenger: binaryMessenger, codec: codec) + let withUserAsyncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.withUserAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { withUserAsyncChannel.setMessageHandler { message, reply in let args = message as! [Any?] let userArg = args[0] as! String let passwordArg = args[1] as! String let persistenceArg = args[2] as! UrlCredentialPersistence - api.pigeonDelegate.withUserAsync(pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg) { result in + api.pigeonDelegate.withUserAsync( + pigeonApi: api, user: userArg, password: passwordArg, persistence: persistenceArg + ) { result in switch result { case .success(let res): reply(wrapResult(res)) @@ -5712,7 +6732,9 @@ withIdentifier: pigeonIdentifierArg) } else { withUserAsyncChannel.setMessageHandler(nil) } - let serverTrustAsyncChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.serverTrustAsync", binaryMessenger: binaryMessenger, codec: codec) + let serverTrustAsyncChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLCredential.serverTrustAsync", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { serverTrustAsyncChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -5732,21 +6754,26 @@ withIdentifier: pigeonIdentifierArg) } ///Creates a Dart instance of URLCredential and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLCredential, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLCredential, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5766,21 +6793,27 @@ withIdentifier: pigeonIdentifierArg) } protocol PigeonApiDelegateURLProtectionSpace { /// The receiver’s host. - func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String + func host(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws + -> String /// The receiver’s port. - func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> Int64 + func port(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws + -> Int64 /// The receiver’s authentication realm. - func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? + func realm(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws + -> String? /// The authentication method used by the receiver. - func authenticationMethod(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> String? + func authenticationMethod( + pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace + ) throws -> String? /// A representation of the server’s SSL transaction state. - func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) throws -> SecTrustWrapper? + func getServerTrust(pigeonApi: PigeonApiURLProtectionSpace, pigeonInstance: URLProtectionSpace) + throws -> SecTrustWrapper? } protocol PigeonApiProtocolURLProtectionSpace { } -final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { +final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLProtectionSpace ///An implementation of [NSObject] used to access callback methods @@ -5788,23 +6821,32 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLProtectionSpace) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateURLProtectionSpace + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLProtectionSpace? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getServerTrustChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", binaryMessenger: binaryMessenger, codec: codec) + let getServerTrustChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLProtectionSpace.getServerTrust", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getServerTrustChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLProtectionSpace do { - let result = try api.pigeonDelegate.getServerTrust(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getServerTrust( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -5816,26 +6858,34 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } ///Creates a Dart instance of URLProtectionSpace and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLProtectionSpace, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLProtectionSpace, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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 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 + 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 @@ -5854,13 +6904,15 @@ final class PigeonApiURLProtectionSpace: PigeonApiProtocolURLProtectionSpace { } protocol PigeonApiDelegateURLAuthenticationChallenge { /// The receiver’s protection space. - func getProtectionSpace(pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge) throws -> URLProtectionSpace + func getProtectionSpace( + pigeonApi: PigeonApiURLAuthenticationChallenge, pigeonInstance: URLAuthenticationChallenge + ) throws -> URLProtectionSpace } protocol PigeonApiProtocolURLAuthenticationChallenge { } -final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticationChallenge { +final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticationChallenge { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURLAuthenticationChallenge ///An implementation of [NSObject] used to access callback methods @@ -5868,23 +6920,33 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateURLAuthenticationChallenge) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateURLAuthenticationChallenge + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLAuthenticationChallenge?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiURLAuthenticationChallenge? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getProtectionSpaceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.getProtectionSpace", binaryMessenger: binaryMessenger, codec: codec) + let getProtectionSpaceChannel = FlutterBasicMessageChannel( + name: + "dev.flutter.pigeon.webview_flutter_wkwebview.URLAuthenticationChallenge.getProtectionSpace", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getProtectionSpaceChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URLAuthenticationChallenge do { - let result = try api.pigeonDelegate.getProtectionSpace(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getProtectionSpace( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -5896,21 +6958,27 @@ final class PigeonApiURLAuthenticationChallenge: PigeonApiProtocolURLAuthenticat } ///Creates a Dart instance of URLAuthenticationChallenge and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URLAuthenticationChallenge, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URLAuthenticationChallenge, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -5936,7 +7004,7 @@ protocol PigeonApiDelegateURL { protocol PigeonApiProtocolURL { } -final class PigeonApiURL: PigeonApiProtocolURL { +final class PigeonApiURL: PigeonApiProtocolURL { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateURL ///An implementation of [NSObject] used to access callback methods @@ -5952,15 +7020,19 @@ final class PigeonApiURL: PigeonApiProtocolURL { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let getAbsoluteStringChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.URL.getAbsoluteString", binaryMessenger: binaryMessenger, codec: codec) + let getAbsoluteStringChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.URL.getAbsoluteString", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getAbsoluteStringChannel.setMessageHandler { message, reply in let args = message as! [Any?] let pigeonInstanceArg = args[0] as! URL do { - let result = try api.pigeonDelegate.getAbsoluteString(pigeonApi: api, pigeonInstance: pigeonInstanceArg) + let result = try api.pigeonDelegate.getAbsoluteString( + pigeonApi: api, pigeonInstance: pigeonInstanceArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -5972,21 +7044,26 @@ final class PigeonApiURL: PigeonApiProtocolURL { } ///Creates a Dart instance of URL and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: URL, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: URL, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -6008,13 +7085,15 @@ 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 + func setAllowsContentJavaScript( + pigeonApi: PigeonApiWKWebpagePreferences, pigeonInstance: WKWebpagePreferences, allow: Bool) + throws } protocol PigeonApiProtocolWKWebpagePreferences { } -final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { +final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateWKWebpagePreferences ///An implementation of [NSObject] used to access callback methods @@ -6022,25 +7101,35 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateWKWebpagePreferences) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateWKWebpagePreferences + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiWKWebpagePreferences? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + 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) + 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) + try api.pigeonDelegate.setAllowsContentJavaScript( + pigeonApi: api, pigeonInstance: pigeonInstanceArg, allow: allowArg) reply(wrapResult(nil)) } catch { reply(wrapError(error)) @@ -6049,16 +7138,21 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } else { setAllowsContentJavaScriptChannel.setMessageHandler(nil) } - } else { + } else { let setAllowsContentJavaScriptChannel = FlutterBasicMessageChannel( - name: "dev.flutter.pigeon.webview_flutter_wkwebview.WKWebpagePreferences.setAllowsContentJavaScript", + 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 - ))) + reply( + wrapError( + FlutterError( + code: "PigeonUnsupportedOperationError", + message: + "Call to setAllowsContentJavaScript requires @available(iOS 13.0.0, macOS 10.15.0, *).", + details: nil + ))) } } else { setAllowsContentJavaScriptChannel.setMessageHandler(nil) @@ -6068,21 +7162,26 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences ///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) { + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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) + 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))) @@ -6102,17 +7201,20 @@ final class PigeonApiWKWebpagePreferences: PigeonApiProtocolWKWebpagePreferences } protocol PigeonApiDelegateGetTrustResultResponse { /// The result code from the most recent trust evaluation. - func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> DartSecTrustResultType + func result(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) + throws -> DartSecTrustResultType /// A result code. /// /// See https://developer.apple.com/documentation/security/security-framework-result-codes?language=objc. - func resultCode(pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse) throws -> Int64 + func resultCode( + pigeonApi: PigeonApiGetTrustResultResponse, pigeonInstance: GetTrustResultResponse + ) throws -> Int64 } protocol PigeonApiProtocolGetTrustResultResponse { } -final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResponse { +final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResponse { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateGetTrustResultResponse ///An implementation of [NSObject] used to access callback methods @@ -6120,28 +7222,38 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateGetTrustResultResponse) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, + delegate: PigeonApiDelegateGetTrustResultResponse + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } ///Creates a Dart instance of GetTrustResultResponse and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: GetTrustResultResponse, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: GetTrustResultResponse, + 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } else { + let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance( + pigeonInstance as AnyObject) let resultArg = try! pigeonDelegate.result(pigeonApi: self, pigeonInstance: pigeonInstance) - let resultCodeArg = try! pigeonDelegate.resultCode(pigeonApi: self, pigeonInstance: pigeonInstance) + let resultCodeArg = try! pigeonDelegate.resultCode( + pigeonApi: self, pigeonInstance: pigeonInstance) let binaryMessenger = pigeonRegistrar.binaryMessenger let codec = pigeonRegistrar.codec - let channelName: String = "dev.flutter.pigeon.webview_flutter_wkwebview.GetTrustResultResponse.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.GetTrustResultResponse.pigeon_newInstance" + let channel = FlutterBasicMessageChannel( + name: channelName, binaryMessenger: binaryMessenger, codec: codec) channel.sendMessage([pigeonIdentifierArg, resultArg, resultCodeArg] as [Any?]) { response in guard let listResponse = response as? [Any?] else { completion(.failure(createConnectionError(withChannelName: channelName))) @@ -6161,23 +7273,30 @@ final class PigeonApiGetTrustResultResponse: PigeonApiProtocolGetTrustResultResp } protocol PigeonApiDelegateSecTrust { /// Evaluates trust for the specified certificate and policies. - func evaluateWithError(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, completion: @escaping (Result) -> Void) + func evaluateWithError( + pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, + completion: @escaping (Result) -> Void) /// Returns an opaque cookie containing exceptions to trust policies that will /// allow future evaluations of the current certificate to succeed. - func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> FlutterStandardTypedData? + func copyExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws + -> FlutterStandardTypedData? /// Sets a list of exceptions that should be ignored when the certificate is /// evaluated. - func setExceptions(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData?) throws -> Bool + func setExceptions( + pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper, exceptions: FlutterStandardTypedData? + ) throws -> Bool /// Returns the result code from the most recent trust evaluation. - func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> GetTrustResultResponse + func getTrustResult(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws + -> GetTrustResultResponse /// Certificates used to evaluate trust. - func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws -> [SecCertificateWrapper]? + func copyCertificateChain(pigeonApi: PigeonApiSecTrust, trust: SecTrustWrapper) throws + -> [SecCertificateWrapper]? } protocol PigeonApiProtocolSecTrust { } -final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { +final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateSecTrust ///An implementation of [NSObject] used to access callback methods @@ -6189,13 +7308,17 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecTrust?) { + static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecTrust?) + { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let evaluateWithErrorChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.evaluateWithError", binaryMessenger: binaryMessenger, codec: codec) + let evaluateWithErrorChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.evaluateWithError", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { evaluateWithErrorChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6212,7 +7335,9 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { evaluateWithErrorChannel.setMessageHandler(nil) } - let copyExceptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyExceptions", binaryMessenger: binaryMessenger, codec: codec) + let copyExceptionsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyExceptions", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyExceptionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6227,14 +7352,17 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { copyExceptionsChannel.setMessageHandler(nil) } - let setExceptionsChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.setExceptions", binaryMessenger: binaryMessenger, codec: codec) + let setExceptionsChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.setExceptions", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { setExceptionsChannel.setMessageHandler { message, reply in let args = message as! [Any?] let trustArg = args[0] as! SecTrustWrapper let exceptionsArg: FlutterStandardTypedData? = nilOrValue(args[1]) do { - let result = try api.pigeonDelegate.setExceptions(pigeonApi: api, trust: trustArg, exceptions: exceptionsArg) + let result = try api.pigeonDelegate.setExceptions( + pigeonApi: api, trust: trustArg, exceptions: exceptionsArg) reply(wrapResult(result)) } catch { reply(wrapError(error)) @@ -6243,7 +7371,9 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { setExceptionsChannel.setMessageHandler(nil) } - let getTrustResultChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.getTrustResult", binaryMessenger: binaryMessenger, codec: codec) + let getTrustResultChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.getTrustResult", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { getTrustResultChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6258,7 +7388,9 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } else { getTrustResultChannel.setMessageHandler(nil) } - let copyCertificateChainChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyCertificateChain", binaryMessenger: binaryMessenger, codec: codec) + let copyCertificateChainChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.copyCertificateChain", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyCertificateChainChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6276,21 +7408,26 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } ///Creates a Dart instance of SecTrust and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: SecTrustWrapper, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: SecTrustWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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.SecTrust.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.SecTrust.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))) @@ -6310,13 +7447,14 @@ final class PigeonApiSecTrust: PigeonApiProtocolSecTrust { } protocol PigeonApiDelegateSecCertificate { /// Returns a DER representation of a certificate given a certificate object. - func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws -> FlutterStandardTypedData + func copyData(pigeonApi: PigeonApiSecCertificate, certificate: SecCertificateWrapper) throws + -> FlutterStandardTypedData } protocol PigeonApiProtocolSecCertificate { } -final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { +final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { unowned let pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar let pigeonDelegate: PigeonApiDelegateSecCertificate ///An implementation of [NSObject] used to access callback methods @@ -6324,17 +7462,24 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { return pigeonRegistrar.apiDelegate.pigeonApiNSObject(pigeonRegistrar) } - init(pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateSecCertificate) { + init( + pigeonRegistrar: WebKitLibraryPigeonProxyApiRegistrar, delegate: PigeonApiDelegateSecCertificate + ) { self.pigeonRegistrar = pigeonRegistrar self.pigeonDelegate = delegate } - static func setUpMessageHandlers(binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecCertificate?) { + static func setUpMessageHandlers( + binaryMessenger: FlutterBinaryMessenger, api: PigeonApiSecCertificate? + ) { let codec: FlutterStandardMessageCodec = api != nil ? FlutterStandardMessageCodec( - readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter(pigeonRegistrar: api!.pigeonRegistrar)) + readerWriter: WebKitLibraryPigeonInternalProxyApiCodecReaderWriter( + pigeonRegistrar: api!.pigeonRegistrar)) : FlutterStandardMessageCodec.sharedInstance() - let copyDataChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.copyData", binaryMessenger: binaryMessenger, codec: codec) + let copyDataChannel = FlutterBasicMessageChannel( + name: "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.copyData", + binaryMessenger: binaryMessenger, codec: codec) if let api = api { copyDataChannel.setMessageHandler { message, reply in let args = message as! [Any?] @@ -6352,21 +7497,26 @@ final class PigeonApiSecCertificate: PigeonApiProtocolSecCertificate { } ///Creates a Dart instance of SecCertificate and attaches it to [pigeonInstance]. - func pigeonNewInstance(pigeonInstance: SecCertificateWrapper, completion: @escaping (Result) -> Void) { + func pigeonNewInstance( + pigeonInstance: SecCertificateWrapper, 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) { + } else if pigeonRegistrar.instanceManager.containsInstance(pigeonInstance as AnyObject) { completion(.success(())) - } else { - let pigeonIdentifierArg = pigeonRegistrar.instanceManager.addHostCreatedInstance(pigeonInstance as AnyObject) + } 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.SecCertificate.pigeon_newInstance" - let channel = FlutterBasicMessageChannel(name: channelName, binaryMessenger: binaryMessenger, codec: codec) + let channelName: String = + "dev.flutter.pigeon.webview_flutter_wkwebview.SecCertificate.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))) 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 9237f07e6be2..8cf38f76edd3 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 @@ -8,7 +8,8 @@ import 'dart:async'; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; -import 'package:flutter/foundation.dart' show ReadBuffer, WriteBuffer, immutable, protected; +import 'package:flutter/foundation.dart' + show ReadBuffer, WriteBuffer, immutable, protected; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -19,7 +20,8 @@ PlatformException _createConnectionError(String channelName) { ); } -List wrapResponse({Object? result, PlatformException? error, bool empty = false}) { +List wrapResponse( + {Object? result, PlatformException? error, bool empty = false}) { if (empty) { return []; } @@ -28,6 +30,7 @@ List wrapResponse({Object? result, PlatformException? error, bool empty } return [error.code, error.message, error.details]; } + /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -110,9 +113,10 @@ class PigeonInstanceManager { // by calling instanceManager.getIdentifier() inside of `==` while this was a // HashMap). final Expando _identifiers = Expando(); - final Map> _weakInstances = - >{}; - final Map _strongInstances = {}; + final Map> + _weakInstances = >{}; + final Map _strongInstances = + {}; late final Finalizer _finalizer; int _nextIdentifier = 0; @@ -122,7 +126,8 @@ class PigeonInstanceManager { static PigeonInstanceManager _initInstance() { WidgetsFlutterBinding.ensureInitialized(); - final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); + final _PigeonInternalInstanceManagerApi api = + _PigeonInternalInstanceManagerApi(); // Clears the native `PigeonInstanceManager` on the initial use of the Dart one. api.clear(); final PigeonInstanceManager instanceManager = PigeonInstanceManager( @@ -130,42 +135,76 @@ class PigeonInstanceManager { api.removeStrongReference(identifier); }, ); - _PigeonInternalInstanceManagerApi.setUpMessageHandlers(instanceManager: instanceManager); - URLRequest.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - HTTPURLResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - URLResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKUserScript.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKNavigationAction.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKNavigationResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKFrameInfo.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - NSError.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKScriptMessage.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKSecurityOrigin.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - HTTPCookie.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - AuthenticationChallengeResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebsiteDataStore.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + _PigeonInternalInstanceManagerApi.setUpMessageHandlers( + instanceManager: instanceManager); + URLRequest.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + HTTPURLResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + URLResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKUserScript.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKNavigationAction.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKNavigationResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKFrameInfo.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + NSError.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKScriptMessage.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKSecurityOrigin.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + HTTPCookie.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + AuthenticationChallengeResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKWebsiteDataStore.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); UIView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIScrollView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebViewConfiguration.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKUserContentController.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKPreferences.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKScriptMessageHandler.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKNavigationDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - NSObject.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIViewWKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - NSViewWKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebView.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKUIDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKHTTPCookieStore.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - UIScrollViewDelegate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - URLCredential.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - URLProtectionSpace.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - URLAuthenticationChallenge.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + UIScrollView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKWebViewConfiguration.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKUserContentController.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKPreferences.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKScriptMessageHandler.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKNavigationDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + NSObject.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + UIViewWKWebView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + NSViewWKWebView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKWebView.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKUIDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + WKHTTPCookieStore.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + UIScrollViewDelegate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + URLCredential.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + URLProtectionSpace.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + URLAuthenticationChallenge.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); URL.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - WKWebpagePreferences.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - GetTrustResultResponse.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - SecTrust.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); - SecCertificate.pigeon_setUpMessageHandlers(pigeon_instanceManager: instanceManager); + WKWebpagePreferences.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + GetTrustResultResponse.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + SecTrust.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); + SecCertificate.pigeon_setUpMessageHandlers( + pigeon_instanceManager: instanceManager); return instanceManager; } @@ -229,15 +268,20 @@ class PigeonInstanceManager { /// /// This method also expects the host `InstanceManager` to have a strong /// reference to the instance the identifier is associated with. - T? getInstanceWithWeakReference(int identifier) { - final PigeonInternalProxyApiBaseClass? weakInstance = _weakInstances[identifier]?.target; + T? getInstanceWithWeakReference( + int identifier) { + final PigeonInternalProxyApiBaseClass? weakInstance = + _weakInstances[identifier]?.target; if (weakInstance == null) { - final PigeonInternalProxyApiBaseClass? strongInstance = _strongInstances[identifier]; + final PigeonInternalProxyApiBaseClass? strongInstance = + _strongInstances[identifier]; if (strongInstance != null) { - final PigeonInternalProxyApiBaseClass copy = strongInstance.pigeon_copy(); + final PigeonInternalProxyApiBaseClass copy = + strongInstance.pigeon_copy(); _identifiers[copy] = identifier; - _weakInstances[identifier] = WeakReference(copy); + _weakInstances[identifier] = + WeakReference(copy); _finalizer.attach(copy, identifier, detach: copy); return copy as T; } @@ -261,17 +305,20 @@ class PigeonInstanceManager { /// added. /// /// Returns unique identifier of the [instance] added. - void addHostCreatedInstance(PigeonInternalProxyApiBaseClass instance, int identifier) { + void addHostCreatedInstance( + PigeonInternalProxyApiBaseClass instance, int identifier) { _addInstanceWithIdentifier(instance, identifier); } - void _addInstanceWithIdentifier(PigeonInternalProxyApiBaseClass instance, int identifier) { + void _addInstanceWithIdentifier( + PigeonInternalProxyApiBaseClass instance, int identifier) { assert(!containsIdentifier(identifier)); assert(getIdentifier(instance) == null); assert(identifier >= 0); _identifiers[instance] = identifier; - _weakInstances[identifier] = WeakReference(instance); + _weakInstances[identifier] = + WeakReference(instance); _finalizer.attach(instance, identifier, detach: instance); final PigeonInternalProxyApiBaseClass copy = instance.pigeon_copy(); @@ -398,29 +445,29 @@ class _PigeonInternalInstanceManagerApi { } class _PigeonInternalProxyApiBaseCodec extends _PigeonCodec { - const _PigeonInternalProxyApiBaseCodec(this.instanceManager); - final PigeonInstanceManager instanceManager; - @override - void writeValue(WriteBuffer buffer, Object? value) { - if (value is PigeonInternalProxyApiBaseClass) { - buffer.putUint8(128); - writeValue(buffer, instanceManager.getIdentifier(value)); - } else { - super.writeValue(buffer, value); - } - } - @override - Object? readValueOfType(int type, ReadBuffer buffer) { - switch (type) { - case 128: - return instanceManager - .getInstanceWithWeakReference(readValue(buffer)! as int); - default: - return super.readValueOfType(type, buffer); - } - } -} + const _PigeonInternalProxyApiBaseCodec(this.instanceManager); + final PigeonInstanceManager instanceManager; + @override + void writeValue(WriteBuffer buffer, Object? value) { + if (value is PigeonInternalProxyApiBaseClass) { + buffer.putUint8(128); + writeValue(buffer, instanceManager.getIdentifier(value)); + } else { + super.writeValue(buffer, value); + } + } + @override + Object? readValueOfType(int type, ReadBuffer buffer) { + switch (type) { + case 128: + return instanceManager + .getInstanceWithWeakReference(readValue(buffer)! as int); + default: + return super.readValueOfType(type, buffer); + } + } +} /// The values that can be returned in a change dictionary. /// @@ -429,12 +476,15 @@ enum KeyValueObservingOptions { /// Indicates that the change dictionary should provide the new attribute /// value, if applicable. newValue, + /// Indicates that the change dictionary should contain the old attribute /// value, if applicable. oldValue, + /// If specified, a notification should be sent to the observer immediately, /// before the observer registration method even returns. initialValue, + /// Whether separate notifications should be sent to the observer before and /// after each change, instead of a single notification after the change. priorNotification, @@ -446,15 +496,19 @@ enum KeyValueObservingOptions { enum KeyValueChange { /// Indicates that the value of the observed key path was set to a new value. setting, + /// Indicates that an object has been inserted into the to-many relationship /// that is being observed. insertion, + /// Indicates that an object has been removed from the to-many relationship /// that is being observed. removal, + /// Indicates that an object has been replaced in the to-many relationship /// that is being observed. replacement, + /// The value is not recognized by the wrapper. unknown, } @@ -468,23 +522,28 @@ enum KeyValueChangeKey { /// `KeyValueChange.replacement`, the value of this key is a Set object that /// contains the indexes of the inserted, removed, or replaced objects. indexes, + /// An object that contains a value corresponding to one of the /// `KeyValueChange` enum, indicating what sort of change has occurred. kind, + /// If the value of the `KeyValueChange.kind` entry is /// `KeyValueChange.setting, and `KeyValueObservingOptions.newValue` was /// specified when the observer was registered, the value of this key is the /// new value for the attribute. newValue, + /// If the `KeyValueObservingOptions.priorNotification` option was specified /// when the observer was registered this notification is sent prior to a /// change. notificationIsPrior, + /// If the value of the `KeyValueChange.kind` entry is /// `KeyValueChange.setting`, and `KeyValueObservingOptions.old` was specified /// when the observer was registered, the value of this key is the value /// before the attribute was changed. oldValue, + /// The value is not recognized by the wrapper. unknown, } @@ -496,9 +555,11 @@ enum UserScriptInjectionTime { /// A constant to inject the script after the creation of the webpage’s /// document element, but before loading any other content. atDocumentStart, + /// A constant to inject the script after the document finishes loading, but /// before loading any other subresources. atDocumentEnd, + /// The value is not recognized by the wrapper. unknown, } @@ -509,10 +570,13 @@ enum UserScriptInjectionTime { enum AudiovisualMediaType { /// No media types require a user gesture to begin playing. none, + /// Media types that contain audio require a user gesture to begin playing. audio, + /// Media types that contain video require a user gesture to begin playing. video, + /// All media types require a user gesture to begin playing. all, } @@ -524,18 +588,25 @@ enum AudiovisualMediaType { enum WebsiteDataType { /// Cookies. cookies, + /// In-memory caches. memoryCache, + /// On-disk caches. diskCache, + /// HTML offline web app caches. offlineWebApplicationCache, + /// HTML local storage. localStorage, + /// HTML session storage. sessionStorage, + /// WebSQL databases. webSQLDatabases, + /// IndexedDB databases. indexedDBDatabases, } @@ -547,8 +618,10 @@ enum WebsiteDataType { enum NavigationActionPolicy { /// Allow the navigation to continue. allow, + /// Cancel the navigation. cancel, + /// Allow the download to proceed. download, } @@ -560,8 +633,10 @@ enum NavigationActionPolicy { enum NavigationResponsePolicy { /// Allow the navigation to continue. allow, + /// Cancel the navigation. cancel, + /// Allow the download to proceed. download, } @@ -572,37 +647,51 @@ enum NavigationResponsePolicy { enum HttpCookiePropertyKey { /// A String object containing the comment for the cookie. comment, + /// An Uri object or String object containing the comment URL for the cookie. commentUrl, + /// Aa String object stating whether the cookie should be discarded at the end /// of the session. discard, + /// An String object containing the domain for the cookie. domain, + /// An Date object or String object specifying the expiration date for the /// cookie. expires, + /// An String object containing an integer value stating how long in seconds /// the cookie should be kept, at most. maximumAge, + /// An String object containing the name of the cookie (required). name, + /// A URL or String object containing the URL that set this cookie. originUrl, + /// A String object containing the path for the cookie. path, + /// An String object containing comma-separated integer values specifying the /// ports for the cookie. port, + /// A string indicating the same-site policy for the cookie. sameSitePolicy, + /// A String object indicating that the cookie should be transmitted only over /// secure channels. secure, + /// A String object containing the value of the cookie. value, + /// A String object that specifies the version of the cookie. version, + /// The value is not recognized by the wrapper. unknown, } @@ -613,16 +702,22 @@ enum HttpCookiePropertyKey { enum NavigationType { /// A link activation. linkActivated, + /// A request to submit a form. formSubmitted, + /// A request for the frame’s next or previous item. backForward, + /// A request to reload the webpage. reload, + /// A request to resubmit a form. formResubmitted, + /// A navigation request that originates for some other reason. other, + /// The value is not recognized by the wrapper. unknown, } @@ -633,8 +728,10 @@ enum NavigationType { enum PermissionDecision { /// Deny permission for the requested resource. deny, + /// Deny permission for the requested resource. grant, + /// Prompt the user for permission for the requested resource. prompt, } @@ -645,10 +742,13 @@ enum PermissionDecision { enum MediaCaptureType { /// A media device that can capture video. camera, + /// A media device or devices that can capture audio and video. cameraAndMicrophone, + /// A media device that can capture audio. microphone, + /// The value is not recognized by the wrapper. unknown, } @@ -659,14 +759,18 @@ enum MediaCaptureType { enum UrlSessionAuthChallengeDisposition { /// Use the specified credential, which may be nil. useCredential, + /// Use the default handling for the challenge as though this delegate method /// were not implemented. performDefaultHandling, + /// Cancel the entire request. cancelAuthenticationChallenge, + /// Reject this challenge, and call the authentication delegate method again /// with the next authentication protection space. rejectProtectionSpace, + /// The value is not recognized by the wrapper. unknown, } @@ -677,10 +781,13 @@ enum UrlSessionAuthChallengeDisposition { enum UrlCredentialPersistence { /// The credential should not be stored. none, + /// The credential should be stored only for this session. forSession, + /// The credential should be stored in the keychain. permanent, + /// The credential should be stored permanently in the keychain, and in /// addition should be distributed to other devices based on the owning Apple /// ID. @@ -693,26 +800,33 @@ enum UrlCredentialPersistence { enum DartSecTrustResultType { /// The user did not specify a trust setting. unspecified, + /// The user granted permission to trust the certificate for the purposes /// designated in the specified policies. proceed, + /// The user specified that the certificate should not be trusted. deny, + /// Trust is denied, but recovery may be possible. recoverableTrustFailure, + /// Trust is denied and no simple fix is available. fatalTrustFailure, + /// A value that indicates a failure other than trust evaluation. otherError, + /// An indication of an invalid setting or result. invalid, + /// User confirmation is required before proceeding. confirm, + /// The type is not recognized by this wrapper. unknown, } - class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -720,49 +834,49 @@ class _PigeonCodec extends StandardMessageCodec { if (value is int) { buffer.putUint8(4); buffer.putInt64(value); - } else if (value is KeyValueObservingOptions) { + } else if (value is KeyValueObservingOptions) { buffer.putUint8(129); writeValue(buffer, value.index); - } else if (value is KeyValueChange) { + } else if (value is KeyValueChange) { buffer.putUint8(130); writeValue(buffer, value.index); - } else if (value is KeyValueChangeKey) { + } else if (value is KeyValueChangeKey) { buffer.putUint8(131); writeValue(buffer, value.index); - } else if (value is UserScriptInjectionTime) { + } else if (value is UserScriptInjectionTime) { buffer.putUint8(132); writeValue(buffer, value.index); - } else if (value is AudiovisualMediaType) { + } else if (value is AudiovisualMediaType) { buffer.putUint8(133); writeValue(buffer, value.index); - } else if (value is WebsiteDataType) { + } else if (value is WebsiteDataType) { buffer.putUint8(134); writeValue(buffer, value.index); - } else if (value is NavigationActionPolicy) { + } else if (value is NavigationActionPolicy) { buffer.putUint8(135); writeValue(buffer, value.index); - } else if (value is NavigationResponsePolicy) { + } else if (value is NavigationResponsePolicy) { buffer.putUint8(136); writeValue(buffer, value.index); - } else if (value is HttpCookiePropertyKey) { + } else if (value is HttpCookiePropertyKey) { buffer.putUint8(137); writeValue(buffer, value.index); - } else if (value is NavigationType) { + } else if (value is NavigationType) { buffer.putUint8(138); writeValue(buffer, value.index); - } else if (value is PermissionDecision) { + } else if (value is PermissionDecision) { buffer.putUint8(139); writeValue(buffer, value.index); - } else if (value is MediaCaptureType) { + } else if (value is MediaCaptureType) { buffer.putUint8(140); writeValue(buffer, value.index); - } else if (value is UrlSessionAuthChallengeDisposition) { + } else if (value is UrlSessionAuthChallengeDisposition) { buffer.putUint8(141); writeValue(buffer, value.index); - } else if (value is UrlCredentialPersistence) { + } else if (value is UrlCredentialPersistence) { buffer.putUint8(142); writeValue(buffer, value.index); - } else if (value is DartSecTrustResultType) { + } else if (value is DartSecTrustResultType) { buffer.putUint8(143); writeValue(buffer, value.index); } else { @@ -773,49 +887,51 @@ class _PigeonCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 129: + case 129: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueObservingOptions.values[value]; - case 130: + case 130: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChange.values[value]; - case 131: + case 131: final int? value = readValue(buffer) as int?; return value == null ? null : KeyValueChangeKey.values[value]; - case 132: + case 132: final int? value = readValue(buffer) as int?; return value == null ? null : UserScriptInjectionTime.values[value]; - case 133: + case 133: final int? value = readValue(buffer) as int?; return value == null ? null : AudiovisualMediaType.values[value]; - case 134: + case 134: final int? value = readValue(buffer) as int?; return value == null ? null : WebsiteDataType.values[value]; - case 135: + case 135: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationActionPolicy.values[value]; - case 136: + case 136: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationResponsePolicy.values[value]; - case 137: + case 137: final int? value = readValue(buffer) as int?; return value == null ? null : HttpCookiePropertyKey.values[value]; - case 138: + case 138: final int? value = readValue(buffer) as int?; return value == null ? null : NavigationType.values[value]; - case 139: + case 139: final int? value = readValue(buffer) as int?; return value == null ? null : PermissionDecision.values[value]; - case 140: + case 140: final int? value = readValue(buffer) as int?; return value == null ? null : MediaCaptureType.values[value]; - case 141: + case 141: final int? value = readValue(buffer) as int?; - return value == null ? null : UrlSessionAuthChallengeDisposition.values[value]; - case 142: + return value == null + ? null + : UrlSessionAuthChallengeDisposition.values[value]; + case 142: final int? value = readValue(buffer) as int?; return value == null ? null : UrlCredentialPersistence.values[value]; - case 143: + case 143: final int? value = readValue(buffer) as int?; return value == null ? null : DartSecTrustResultType.values[value]; default: @@ -823,6 +939,7 @@ class _PigeonCodec extends StandardMessageCodec { } } } + /// A URL load request that is independent of protocol or URL scheme. /// /// See https://developer.apple.com/documentation/foundation/urlrequest. @@ -8609,4 +8726,3 @@ class SecCertificate extends NSObject { ); } } - From 2981d003a8c5e35eda4a655e85a1d8c42aa9a88b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:57:32 -0400 Subject: [PATCH 31/34] fix ios tests --- .../Tests/NavigationDelegateProxyAPITests.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift index 822e38025ff6..9259d59ac281 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift @@ -217,21 +217,21 @@ class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate { } func didReceiveAuthenticationChallenge( - pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, + pigeonInstance pigeonInstanceArg: any WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping ( Result< - [Any?], + webview_flutter_wkwebview.AuthenticationChallengeResponse, webview_flutter_wkwebview.PigeonError > ) -> Void ) { didReceiveAuthenticationChallengeArgs = [webViewArg, challengeArg] completion( - .success([ - UrlSessionAuthChallengeDisposition.useCredential, - ["user": "user1", "password": "password1", "persistence": UrlCredentialPersistence.none], - ])) + .success( + AuthenticationChallengeResponse( + disposition: .useCredential, + credential: URLCredential(user: "user1", password: "password1", persistence: .none)))) } } From 1f0aa846b846e089b987f3ee61f2564e7a5b42e7 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 15:11:51 -0400 Subject: [PATCH 32/34] formatting and any remove --- .../lib/src/platform_navigation_delegate.dart | 3 +++ .../AuthenticationChallengeResponseProxyAPIDelegate.swift | 2 +- .../URLCredentialProxyAPIDelegate.swift | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart index e2222a815961..040ab2466136 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_navigation_delegate.dart @@ -37,6 +37,9 @@ typedef HttpAuthRequestCallback = void Function(HttpAuthRequest request); /// Signature for callbacks that notify the host application of an SSL /// authentication error. +/// +/// The host application must call either [PlatformSslAuthError.cancel] or +/// [PlatformSslAuthError.proceed]. typedef SslAuthErrorCallback = void Function(PlatformSslAuthError error); /// An interface defining navigation events that occur on the native platform. diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift index e90e137cddc5..5ebfdcab1e1b 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/AuthenticationChallengeResponseProxyAPIDelegate.swift @@ -37,7 +37,7 @@ class AuthenticationChallengeResponseProxyAPIDelegate: func createAsync( pigeonApi: PigeonApiAuthenticationChallengeResponse, disposition: UrlSessionAuthChallengeDisposition, credential: URLCredential?, - completion: @escaping (Result) -> Void + completion: @escaping (Result) -> Void ) { completion( Result.success( diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift index 3e117a24e56a..39d6973435a9 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/webview_flutter_wkwebview/Sources/webview_flutter_wkwebview/URLCredentialProxyAPIDelegate.swift @@ -30,7 +30,7 @@ class URLCredentialProxyAPIDelegate: PigeonApiDelegateURLCredential { func withUserAsync( pigeonApi: PigeonApiURLCredential, user: String, password: String, persistence: UrlCredentialPersistence, - completion: @escaping (Result) -> Void + completion: @escaping (Result) -> Void ) { completion( Result.success( @@ -40,7 +40,7 @@ class URLCredentialProxyAPIDelegate: PigeonApiDelegateURLCredential { func serverTrustAsync( pigeonApi: PigeonApiURLCredential, trust: SecTrustWrapper, - completion: @escaping (Result) -> Void + completion: @escaping (Result) -> Void ) { completion(Result.success(URLCredential(trust: trust.value))) } From f4d1e59c319ebfc31a081c91e245c13aeb32449d Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 15:13:59 -0400 Subject: [PATCH 33/34] remove any again --- .../darwin/Tests/NavigationDelegateProxyAPITests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift index 9259d59ac281..df77486425b6 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift +++ b/packages/webview_flutter/webview_flutter_wkwebview/darwin/Tests/NavigationDelegateProxyAPITests.swift @@ -217,7 +217,7 @@ class TestNavigationDelegateApi: PigeonApiProtocolWKNavigationDelegate { } func didReceiveAuthenticationChallenge( - pigeonInstance pigeonInstanceArg: any WKNavigationDelegate, webView webViewArg: WKWebView, + pigeonInstance pigeonInstanceArg: WKNavigationDelegate, webView webViewArg: WKWebView, challenge challengeArg: URLAuthenticationChallenge, completion: @escaping ( Result< From 364b3c1ee37f9c7c850f53a285f2ed13ecddcee3 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Apr 2025 15:40:31 -0400 Subject: [PATCH 34/34] add test to verify perform is default --- .../lib/src/webkit_webview_controller.dart | 12 ++-- .../test/webkit_navigation_delegate_test.dart | 70 +++++++++++++++++++ 2 files changed, 77 insertions(+), 5 deletions(-) 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 aad23ade17dd..8f0fdc2ccf2d 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 @@ -1236,12 +1236,13 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { ) async { final WebKitNavigationDelegate? delegate = weakThis.target; - if (delegate != null) { + final WebKitProxy? proxy = + (delegate?.params as WebKitNavigationDelegateCreationParams?) + ?.webKitProxy; + + if (delegate != null && proxy != null) { final URLProtectionSpace protectionSpace = await challenge.getProtectionSpace(); - final WebKitProxy proxy = - (delegate.params as WebKitNavigationDelegateCreationParams) - .webKitProxy; final Completer responseCompleter = Completer(); @@ -1347,7 +1348,8 @@ class WebKitNavigationDelegate extends PlatformNavigationDelegate { } } - return AuthenticationChallengeResponse.createAsync( + return (proxy ?? const WebKitProxy()) + .createAsyncAuthenticationChallengeResponse( UrlSessionAuthChallengeDisposition.performDefaultHandling, null, ); 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 c25134f50645..577d3b9eba56 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 @@ -776,6 +776,76 @@ void main() { UrlSessionAuthChallengeDisposition.cancelAuthenticationChallenge, ); }); + + test( + 'didReceiveAuthenticationChallenge calls performDefaultHandling by default', + () async { + WebKitNavigationDelegate( + WebKitNavigationDelegateCreationParams( + webKitProxy: WebKitProxy( + newWKNavigationDelegate: CapturingNavigationDelegate.new, + createAsyncAuthenticationChallengeResponse: ( + UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + ) async { + return AuthenticationChallengeResponse.pigeon_detached( + disposition: disposition, + credential: credential, + pigeon_instanceManager: TestInstanceManager(), + ); + }, + ), + ), + ); + + final MockURLAuthenticationChallenge mockChallenge = + MockURLAuthenticationChallenge(); + when(mockChallenge.getProtectionSpace()).thenAnswer( + (_) async { + final MockURLProtectionSpace mockProtectionSpace = + MockURLProtectionSpace(); + when(mockProtectionSpace.authenticationMethod).thenReturn( + NSUrlAuthenticationMethod.httpBasic, + ); + return mockProtectionSpace; + }, + ); + + final WKNavigationDelegate testDelegate = + 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(), + ); + }, + ); + final WKWebView testWebView = WKWebView.pigeon_detached( + pigeon_instanceManager: TestInstanceManager(), + ); + + final AuthenticationChallengeResponse authReply = + await CapturingNavigationDelegate.lastCreatedDelegate + .didReceiveAuthenticationChallenge( + testDelegate, + testWebView, + mockChallenge, + ); + + expect( + authReply.disposition, + UrlSessionAuthChallengeDisposition.performDefaultHandling, + ); + expect(authReply.credential, isNull); + }); }); }