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 58fc0ed2924..435c697573a 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,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.2), do not edit directly. +// Autogenerated from Pigeon (v26.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") 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 2675271ce50..abfc90f8c63 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,15 +1,16 @@ // Copyright 2013 The Flutter 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.2), do not edit directly. +// Autogenerated from Pigeon (v26.0.0), 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 import 'dart:async'; +import 'dart:io' show Platform; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' - show ReadBuffer, WriteBuffer, immutable, protected; + show ReadBuffer, WriteBuffer, immutable, protected, visibleForTesting; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -31,6 +32,227 @@ List wrapResponse( return [error.code, error.message, error.details]; } +/// Provides overrides for the constructors and static members of each proxy +/// API. +/// +/// This is only intended to be used with unit tests to prevent errors from +/// making message calls in a unit test. +/// +/// See [PigeonOverrides.pigeon_reset] to set all overrides back to null. +@visibleForTesting +class PigeonOverrides { + /// Overrides [WebView.new]. + static WebView Function( + {void Function( + WebView pigeon_instance, + int left, + int top, + int oldLeft, + int oldTop, + )? onScrollChanged})? webView_new; + + /// Overrides [JavaScriptChannel.new]. + static JavaScriptChannel Function({ + required String channelName, + required void Function( + JavaScriptChannel pigeon_instance, + String message, + ) postMessage, + })? javaScriptChannel_new; + + /// Overrides [WebViewClient.new]. + static WebViewClient Function({ + void Function( + WebViewClient pigeon_instance, + WebView webView, + String url, + )? onPageStarted, + void Function( + WebViewClient pigeon_instance, + WebView webView, + String url, + )? onPageFinished, + void Function( + WebViewClient pigeon_instance, + WebView webView, + WebResourceRequest request, + WebResourceResponse response, + )? onReceivedHttpError, + void Function( + WebViewClient pigeon_instance, + WebView webView, + WebResourceRequest request, + WebResourceError error, + )? onReceivedRequestError, + void Function( + WebViewClient pigeon_instance, + WebView webView, + WebResourceRequest request, + WebResourceErrorCompat error, + )? onReceivedRequestErrorCompat, + void Function( + WebViewClient pigeon_instance, + WebView webView, + int errorCode, + String description, + String failingUrl, + )? onReceivedError, + void Function( + WebViewClient pigeon_instance, + WebView webView, + WebResourceRequest request, + )? requestLoading, + void Function( + WebViewClient pigeon_instance, + WebView webView, + String url, + )? urlLoading, + void Function( + WebViewClient pigeon_instance, + WebView webView, + String url, + bool isReload, + )? doUpdateVisitedHistory, + void Function( + WebViewClient pigeon_instance, + WebView webView, + HttpAuthHandler handler, + String host, + String realm, + )? onReceivedHttpAuthRequest, + void Function( + WebViewClient pigeon_instance, + WebView view, + AndroidMessage dontResend, + AndroidMessage resend, + )? onFormResubmission, + void Function( + WebViewClient pigeon_instance, + WebView view, + String url, + )? onLoadResource, + void Function( + WebViewClient pigeon_instance, + WebView view, + String url, + )? onPageCommitVisible, + void Function( + WebViewClient pigeon_instance, + WebView view, + ClientCertRequest request, + )? onReceivedClientCertRequest, + void Function( + WebViewClient pigeon_instance, + WebView view, + String realm, + String? account, + String args, + )? onReceivedLoginRequest, + void Function( + WebViewClient pigeon_instance, + WebView view, + SslErrorHandler handler, + SslError error, + )? onReceivedSslError, + void Function( + WebViewClient pigeon_instance, + WebView view, + double oldScale, + double newScale, + )? onScaleChanged, + })? webViewClient_new; + + /// Overrides [DownloadListener.new]. + static DownloadListener Function( + {required void Function( + DownloadListener pigeon_instance, + String url, + String userAgent, + String contentDisposition, + String mimetype, + int contentLength, + ) onDownloadStart})? downloadListener_new; + + /// Overrides [WebChromeClient.new]. + static WebChromeClient Function({ + required Future> Function( + WebChromeClient pigeon_instance, + WebView webView, + FileChooserParams params, + ) onShowFileChooser, + required Future Function( + WebChromeClient pigeon_instance, + WebView webView, + String url, + String message, + ) onJsConfirm, + void Function( + WebChromeClient pigeon_instance, + WebView webView, + int progress, + )? onProgressChanged, + void Function( + WebChromeClient pigeon_instance, + PermissionRequest request, + )? onPermissionRequest, + void Function( + WebChromeClient pigeon_instance, + View view, + CustomViewCallback callback, + )? onShowCustomView, + void Function(WebChromeClient pigeon_instance)? onHideCustomView, + void Function( + WebChromeClient pigeon_instance, + String origin, + GeolocationPermissionsCallback callback, + )? onGeolocationPermissionsShowPrompt, + void Function(WebChromeClient pigeon_instance)? + onGeolocationPermissionsHidePrompt, + void Function( + WebChromeClient pigeon_instance, + ConsoleMessage message, + )? onConsoleMessage, + Future Function( + WebChromeClient pigeon_instance, + WebView webView, + String url, + String message, + )? onJsAlert, + Future Function( + WebChromeClient pigeon_instance, + WebView webView, + String url, + String message, + String defaultValue, + )? onJsPrompt, + })? webChromeClient_new; + + /// Overrides [CookieManager.instance]. + static CookieManager? cookieManager_instance; + + /// Overrides [FlutterAssetManager.instance]. + static FlutterAssetManager? flutterAssetManager_instance; + + /// Overrides [WebStorage.instance]. + static WebStorage? webStorage_instance; + + /// Overrides [WebView.setWebContentsDebuggingEnabled]. + static Future Function(bool)? webView_setWebContentsDebuggingEnabled; + + /// Sets all overridden ProxyApi class members to null. + static void pigeon_reset() { + cookieManager_instance = null; + webView_new = null; + webView_setWebContentsDebuggingEnabled = null; + javaScriptChannel_new = null; + webViewClient_new = null; + downloadListener_new = null; + webChromeClient_new = null; + flutterAssetManager_instance = null; + webStorage_instance = null; + } +} + /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -125,6 +347,9 @@ class PigeonInstanceManager { late final void Function(int) onWeakReferenceRemoved; static PigeonInstanceManager _initInstance() { + if (Platform.environment['FLUTTER_TEST'] == 'true') { + return PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + } WidgetsFlutterBinding.ensureInitialized(); final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); @@ -1262,7 +1487,10 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { late final _PigeonInternalProxyApiBaseCodec _pigeonVar_codecCookieManager = _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); - static final CookieManager instance = pigeonVar_instance(); + static final CookieManager _instance = pigeonVar_instance(); + + static CookieManager get instance => + PigeonOverrides.cookieManager_instance ?? _instance; static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, @@ -1463,7 +1691,29 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { /// /// See https://developer.android.com/reference/android/webkit/WebView. class WebView extends View { - WebView({ + factory WebView({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + WebView pigeon_instance, + int left, + int top, + int oldLeft, + int oldTop, + )? onScrollChanged, + }) { + if (PigeonOverrides.webView_new != null) { + return PigeonOverrides.webView_new!(onScrollChanged: onScrollChanged); + } + return WebView.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + onScrollChanged: onScrollChanged, + ); + } + + @protected + WebView.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, this.onScrollChanged, @@ -2111,6 +2361,9 @@ class WebView extends View { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.webView_setWebContentsDebuggingEnabled != null) { + return PigeonOverrides.webView_setWebContentsDebuggingEnabled!(enabled); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -2962,7 +3215,31 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { /// This is a custom class for the wrapper that is annotated with /// [JavascriptInterface](https://developer.android.com/reference/android/webkit/JavascriptInterface). class JavaScriptChannel extends PigeonInternalProxyApiBaseClass { - JavaScriptChannel({ + factory JavaScriptChannel({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + required String channelName, + required void Function( + JavaScriptChannel pigeon_instance, + String message, + ) postMessage, + }) { + if (PigeonOverrides.javaScriptChannel_new != null) { + return PigeonOverrides.javaScriptChannel_new!( + channelName: channelName, + postMessage: postMessage, + ); + } + return JavaScriptChannel.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + channelName: channelName, + postMessage: postMessage, + ); + } + + @protected + JavaScriptChannel.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, required this.channelName, @@ -3106,7 +3383,154 @@ class JavaScriptChannel extends PigeonInternalProxyApiBaseClass { /// /// See https://developer.android.com/reference/android/webkit/WebViewClient. class WebViewClient extends PigeonInternalProxyApiBaseClass { - WebViewClient({ + factory WebViewClient({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + WebViewClient pigeon_instance, + WebView webView, + String url, + )? onPageStarted, + void Function( + WebViewClient pigeon_instance, + WebView webView, + String url, + )? onPageFinished, + void Function( + WebViewClient pigeon_instance, + WebView webView, + WebResourceRequest request, + WebResourceResponse response, + )? onReceivedHttpError, + void Function( + WebViewClient pigeon_instance, + WebView webView, + WebResourceRequest request, + WebResourceError error, + )? onReceivedRequestError, + void Function( + WebViewClient pigeon_instance, + WebView webView, + WebResourceRequest request, + WebResourceErrorCompat error, + )? onReceivedRequestErrorCompat, + void Function( + WebViewClient pigeon_instance, + WebView webView, + int errorCode, + String description, + String failingUrl, + )? onReceivedError, + void Function( + WebViewClient pigeon_instance, + WebView webView, + WebResourceRequest request, + )? requestLoading, + void Function( + WebViewClient pigeon_instance, + WebView webView, + String url, + )? urlLoading, + void Function( + WebViewClient pigeon_instance, + WebView webView, + String url, + bool isReload, + )? doUpdateVisitedHistory, + void Function( + WebViewClient pigeon_instance, + WebView webView, + HttpAuthHandler handler, + String host, + String realm, + )? onReceivedHttpAuthRequest, + void Function( + WebViewClient pigeon_instance, + WebView view, + AndroidMessage dontResend, + AndroidMessage resend, + )? onFormResubmission, + void Function( + WebViewClient pigeon_instance, + WebView view, + String url, + )? onLoadResource, + void Function( + WebViewClient pigeon_instance, + WebView view, + String url, + )? onPageCommitVisible, + void Function( + WebViewClient pigeon_instance, + WebView view, + ClientCertRequest request, + )? onReceivedClientCertRequest, + void Function( + WebViewClient pigeon_instance, + WebView view, + String realm, + String? account, + String args, + )? onReceivedLoginRequest, + void Function( + WebViewClient pigeon_instance, + WebView view, + SslErrorHandler handler, + SslError error, + )? onReceivedSslError, + void Function( + WebViewClient pigeon_instance, + WebView view, + double oldScale, + double newScale, + )? onScaleChanged, + }) { + if (PigeonOverrides.webViewClient_new != null) { + return PigeonOverrides.webViewClient_new!( + onPageStarted: onPageStarted, + onPageFinished: onPageFinished, + onReceivedHttpError: onReceivedHttpError, + onReceivedRequestError: onReceivedRequestError, + onReceivedRequestErrorCompat: onReceivedRequestErrorCompat, + onReceivedError: onReceivedError, + requestLoading: requestLoading, + urlLoading: urlLoading, + doUpdateVisitedHistory: doUpdateVisitedHistory, + onReceivedHttpAuthRequest: onReceivedHttpAuthRequest, + onFormResubmission: onFormResubmission, + onLoadResource: onLoadResource, + onPageCommitVisible: onPageCommitVisible, + onReceivedClientCertRequest: onReceivedClientCertRequest, + onReceivedLoginRequest: onReceivedLoginRequest, + onReceivedSslError: onReceivedSslError, + onScaleChanged: onScaleChanged, + ); + } + return WebViewClient.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + onPageStarted: onPageStarted, + onPageFinished: onPageFinished, + onReceivedHttpError: onReceivedHttpError, + onReceivedRequestError: onReceivedRequestError, + onReceivedRequestErrorCompat: onReceivedRequestErrorCompat, + onReceivedError: onReceivedError, + requestLoading: requestLoading, + urlLoading: urlLoading, + doUpdateVisitedHistory: doUpdateVisitedHistory, + onReceivedHttpAuthRequest: onReceivedHttpAuthRequest, + onFormResubmission: onFormResubmission, + onLoadResource: onLoadResource, + onPageCommitVisible: onPageCommitVisible, + onReceivedClientCertRequest: onReceivedClientCertRequest, + onReceivedLoginRequest: onReceivedLoginRequest, + onReceivedSslError: onReceivedSslError, + onScaleChanged: onScaleChanged, + ); + } + + @protected + WebViewClient.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, this.onPageStarted, @@ -4564,7 +4988,31 @@ class WebViewClient extends PigeonInternalProxyApiBaseClass { /// /// See https://developer.android.com/reference/android/webkit/DownloadListener. class DownloadListener extends PigeonInternalProxyApiBaseClass { - DownloadListener({ + factory DownloadListener({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + required void Function( + DownloadListener pigeon_instance, + String url, + String userAgent, + String contentDisposition, + String mimetype, + int contentLength, + ) onDownloadStart, + }) { + if (PigeonOverrides.downloadListener_new != null) { + return PigeonOverrides.downloadListener_new!( + onDownloadStart: onDownloadStart); + } + return DownloadListener.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + onDownloadStart: onDownloadStart, + ); + } + + @protected + DownloadListener.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, required this.onDownloadStart, @@ -4728,7 +5176,94 @@ class DownloadListener extends PigeonInternalProxyApiBaseClass { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient. class WebChromeClient extends PigeonInternalProxyApiBaseClass { - WebChromeClient({ + factory WebChromeClient({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + WebChromeClient pigeon_instance, + WebView webView, + int progress, + )? onProgressChanged, + required Future> Function( + WebChromeClient pigeon_instance, + WebView webView, + FileChooserParams params, + ) onShowFileChooser, + void Function( + WebChromeClient pigeon_instance, + PermissionRequest request, + )? onPermissionRequest, + void Function( + WebChromeClient pigeon_instance, + View view, + CustomViewCallback callback, + )? onShowCustomView, + void Function(WebChromeClient pigeon_instance)? onHideCustomView, + void Function( + WebChromeClient pigeon_instance, + String origin, + GeolocationPermissionsCallback callback, + )? onGeolocationPermissionsShowPrompt, + void Function(WebChromeClient pigeon_instance)? + onGeolocationPermissionsHidePrompt, + void Function( + WebChromeClient pigeon_instance, + ConsoleMessage message, + )? onConsoleMessage, + Future Function( + WebChromeClient pigeon_instance, + WebView webView, + String url, + String message, + )? onJsAlert, + required Future Function( + WebChromeClient pigeon_instance, + WebView webView, + String url, + String message, + ) onJsConfirm, + Future Function( + WebChromeClient pigeon_instance, + WebView webView, + String url, + String message, + String defaultValue, + )? onJsPrompt, + }) { + if (PigeonOverrides.webChromeClient_new != null) { + return PigeonOverrides.webChromeClient_new!( + onProgressChanged: onProgressChanged, + onShowFileChooser: onShowFileChooser, + onPermissionRequest: onPermissionRequest, + onShowCustomView: onShowCustomView, + onHideCustomView: onHideCustomView, + onGeolocationPermissionsShowPrompt: onGeolocationPermissionsShowPrompt, + onGeolocationPermissionsHidePrompt: onGeolocationPermissionsHidePrompt, + onConsoleMessage: onConsoleMessage, + onJsAlert: onJsAlert, + onJsConfirm: onJsConfirm, + onJsPrompt: onJsPrompt, + ); + } + return WebChromeClient.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + onProgressChanged: onProgressChanged, + onShowFileChooser: onShowFileChooser, + onPermissionRequest: onPermissionRequest, + onShowCustomView: onShowCustomView, + onHideCustomView: onHideCustomView, + onGeolocationPermissionsShowPrompt: onGeolocationPermissionsShowPrompt, + onGeolocationPermissionsHidePrompt: onGeolocationPermissionsHidePrompt, + onConsoleMessage: onConsoleMessage, + onJsAlert: onJsAlert, + onJsConfirm: onJsConfirm, + onJsPrompt: onJsPrompt, + ); + } + + @protected + WebChromeClient.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, this.onProgressChanged, @@ -5814,7 +6349,11 @@ class FlutterAssetManager extends PigeonInternalProxyApiBaseClass { _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); /// The global instance of the `FlutterAssetManager`. - static final FlutterAssetManager instance = pigeonVar_instance(); + static final FlutterAssetManager _instance = pigeonVar_instance(); + + /// The global instance of the `FlutterAssetManager`. + static FlutterAssetManager get instance => + PigeonOverrides.flutterAssetManager_instance ?? _instance; static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, @@ -6007,7 +6546,10 @@ class WebStorage extends PigeonInternalProxyApiBaseClass { late final _PigeonInternalProxyApiBaseCodec _pigeonVar_codecWebStorage = _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); - static final WebStorage instance = pigeonVar_instance(); + static final WebStorage _instance = pigeonVar_instance(); + + static WebStorage get instance => + PigeonOverrides.webStorage_instance ?? _instance; static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_android_widget.dart b/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_android_widget.dart index b9b311a1abc..b0bee746f8e 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_android_widget.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/legacy/webview_android_widget.dart @@ -608,7 +608,7 @@ class WebViewAndroidJavaScriptChannel WebViewAndroidJavaScriptChannel({ required super.channelName, required this.javascriptChannelRegistry, - }) : super( + }) : super.pigeon_new( postMessage: withWeakReferenceTo( javascriptChannelRegistry, (WeakReference weakReference) { diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 6498db12370..5705402eba9 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -28,7 +28,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^25.3.2 + pigeon: ^26.0.0 topics: - html 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 1d4b6ccec0a..2a13b4508dc 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.2), do not edit directly. +// Autogenerated from Pigeon (v26.0.0), do not edit directly. // See also: https://pub.dev/packages/pigeon import Foundation 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 49a132077b5..0db6228d5d5 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,15 +1,16 @@ // Copyright 2013 The Flutter 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.2), do not edit directly. +// Autogenerated from Pigeon (v26.0.0), 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 import 'dart:async'; +import 'dart:io' show Platform; import 'dart:typed_data' show Float64List, Int32List, Int64List, Uint8List; import 'package:flutter/foundation.dart' - show ReadBuffer, WriteBuffer, immutable, protected; + show ReadBuffer, WriteBuffer, immutable, protected, visibleForTesting; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; @@ -31,6 +32,302 @@ List wrapResponse( return [error.code, error.message, error.details]; } +/// Provides overrides for the constructors and static members of each proxy +/// API. +/// +/// This is only intended to be used with unit tests to prevent errors from +/// making message calls in a unit test. +/// +/// See [PigeonOverrides.pigeon_reset] to set all overrides back to null. +@visibleForTesting +class PigeonOverrides { + /// Overrides [URLRequest.new]. + static URLRequest Function({ + required String url, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + })? uRLRequest_new; + + /// Overrides [WKUserScript.new]. + static WKUserScript Function({ + required String source, + required UserScriptInjectionTime injectionTime, + required bool isForMainFrameOnly, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + })? wKUserScript_new; + + /// Overrides [HTTPCookie.new]. + static HTTPCookie Function({ + required Map properties, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + })? hTTPCookie_new; + + /// Overrides [AuthenticationChallengeResponse.new]. + static AuthenticationChallengeResponse Function({ + required UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + })? authenticationChallengeResponse_new; + + /// Overrides [WKWebViewConfiguration.new]. + static WKWebViewConfiguration Function( + {void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue})? wKWebViewConfiguration_new; + + /// Overrides [WKScriptMessageHandler.new]. + static WKScriptMessageHandler Function({ + required void Function( + WKScriptMessageHandler pigeon_instance, + WKUserContentController controller, + WKScriptMessage message, + ) didReceiveScriptMessage, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + })? wKScriptMessageHandler_new; + + /// Overrides [WKNavigationDelegate.new]. + static WKNavigationDelegate Function({ + required Future Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + WKNavigationAction navigationAction, + ) decidePolicyForNavigationAction, + required Future Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + WKNavigationResponse navigationResponse, + ) decidePolicyForNavigationResponse, + required Future Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + URLAuthenticationChallenge challenge, + ) didReceiveAuthenticationChallenge, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + String? url, + )? didFinishNavigation, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + String? url, + )? didStartProvisionalNavigation, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + NSError error, + )? didFailNavigation, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + NSError error, + )? didFailProvisionalNavigation, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + )? webViewWebContentProcessDidTerminate, + })? wKNavigationDelegate_new; + + /// Overrides [NSObject.new]. + static NSObject Function( + {void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue})? nSObject_new; + + /// Overrides [UIViewWKWebView.new]. + static UIViewWKWebView Function({ + required WKWebViewConfiguration initialConfiguration, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + })? uIViewWKWebView_new; + + /// Overrides [NSViewWKWebView.new]. + static NSViewWKWebView Function({ + required WKWebViewConfiguration initialConfiguration, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + })? nSViewWKWebView_new; + + /// Overrides [WKUIDelegate.new]. + static WKUIDelegate Function({ + required Future Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + WKSecurityOrigin origin, + WKFrameInfo frame, + MediaCaptureType type, + ) requestMediaCapturePermission, + required Future Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + String message, + WKFrameInfo frame, + ) runJavaScriptConfirmPanel, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + void Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + WKWebViewConfiguration configuration, + WKNavigationAction navigationAction, + )? onCreateWebView, + Future Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + String message, + WKFrameInfo frame, + )? runJavaScriptAlertPanel, + Future Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + String prompt, + String? defaultText, + WKFrameInfo frame, + )? runJavaScriptTextInputPanel, + })? wKUIDelegate_new; + + /// Overrides [UIScrollViewDelegate.new]. + static UIScrollViewDelegate Function({ + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + void Function( + UIScrollViewDelegate pigeon_instance, + UIScrollView scrollView, + double x, + double y, + )? scrollViewDidScroll, + })? uIScrollViewDelegate_new; + + /// Overrides [URLCredential.withUser]. + static URLCredential Function({ + required String user, + required String password, + required UrlCredentialPersistence persistence, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + })? uRLCredential_withUser; + + /// Overrides [WKWebsiteDataStore.defaultDataStore]. + static WKWebsiteDataStore? wKWebsiteDataStore_defaultDataStore; + + /// Overrides [AuthenticationChallengeResponse.createAsync]. + static Future Function( + UrlSessionAuthChallengeDisposition, + URLCredential?, + )? authenticationChallengeResponse_createAsync; + + /// Overrides [URLCredential.withUserAsync]. + static Future Function( + String, + String, + UrlCredentialPersistence, + )? uRLCredential_withUserAsync; + + /// Overrides [URLCredential.serverTrustAsync]. + static Future Function(SecTrust)? + uRLCredential_serverTrustAsync; + + /// Overrides [SecTrust.evaluateWithError]. + static Future Function(SecTrust)? secTrust_evaluateWithError; + + /// Overrides [SecTrust.copyExceptions]. + static Future Function(SecTrust)? secTrust_copyExceptions; + + /// Overrides [SecTrust.setExceptions]. + static Future Function( + SecTrust, + Uint8List?, + )? secTrust_setExceptions; + + /// Overrides [SecTrust.getTrustResult]. + static Future Function(SecTrust)? + secTrust_getTrustResult; + + /// Overrides [SecTrust.copyCertificateChain]. + static Future?> Function(SecTrust)? + secTrust_copyCertificateChain; + + /// Overrides [SecCertificate.copyData]. + static Future Function(SecCertificate)? secCertificate_copyData; + + /// Sets all overridden ProxyApi class members to null. + static void pigeon_reset() { + uRLRequest_new = null; + wKUserScript_new = null; + hTTPCookie_new = null; + authenticationChallengeResponse_new = null; + authenticationChallengeResponse_createAsync = null; + wKWebsiteDataStore_defaultDataStore = null; + wKWebViewConfiguration_new = null; + wKScriptMessageHandler_new = null; + wKNavigationDelegate_new = null; + nSObject_new = null; + uIViewWKWebView_new = null; + nSViewWKWebView_new = null; + wKUIDelegate_new = null; + uIScrollViewDelegate_new = null; + uRLCredential_withUser = null; + uRLCredential_withUserAsync = null; + uRLCredential_serverTrustAsync = null; + secTrust_evaluateWithError = null; + secTrust_copyExceptions = null; + secTrust_setExceptions = null; + secTrust_getTrustResult = null; + secTrust_copyCertificateChain = null; + secCertificate_copyData = null; + } +} + /// An immutable object that serves as the base class for all ProxyApis and /// can provide functional copies of itself. /// @@ -125,6 +422,9 @@ class PigeonInstanceManager { late final void Function(int) onWeakReferenceRemoved; static PigeonInstanceManager _initInstance() { + if (Platform.environment['FLUTTER_TEST'] == 'true') { + return PigeonInstanceManager(onWeakReferenceRemoved: (_) {}); + } WidgetsFlutterBinding.ensureInitialized(); final _PigeonInternalInstanceManagerApi api = _PigeonInternalInstanceManagerApi(); @@ -946,7 +1246,33 @@ class _PigeonCodec extends StandardMessageCodec { /// /// See https://developer.apple.com/documentation/foundation/urlrequest. class URLRequest extends NSObject { - URLRequest({ + factory URLRequest({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + required String url, + }) { + if (PigeonOverrides.uRLRequest_new != null) { + return PigeonOverrides.uRLRequest_new!( + observeValue: observeValue, + url: url, + ); + } + return URLRequest.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + url: url, + ); + } + + @protected + URLRequest.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -1433,7 +1759,41 @@ class URLResponse extends NSObject { class WKUserScript extends NSObject { /// Creates a user script object that contains the specified source code and /// attributes. - WKUserScript({ + factory WKUserScript({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + required String source, + required UserScriptInjectionTime injectionTime, + required bool isForMainFrameOnly, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + }) { + if (PigeonOverrides.wKUserScript_new != null) { + return PigeonOverrides.wKUserScript_new!( + source: source, + injectionTime: injectionTime, + isForMainFrameOnly: isForMainFrameOnly, + observeValue: observeValue, + ); + } + return WKUserScript.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + source: source, + injectionTime: injectionTime, + isForMainFrameOnly: isForMainFrameOnly, + observeValue: observeValue, + ); + } + + /// Creates a user script object that contains the specified source code and + /// attributes. + @protected + WKUserScript.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, required this.source, @@ -2195,7 +2555,33 @@ class WKSecurityOrigin extends NSObject { /// /// See https://developer.apple.com/documentation/foundation/httpcookie. class HTTPCookie extends NSObject { - HTTPCookie({ + factory HTTPCookie({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + required Map properties, + }) { + if (PigeonOverrides.hTTPCookie_new != null) { + return PigeonOverrides.hTTPCookie_new!( + observeValue: observeValue, + properties: properties, + ); + } + return HTTPCookie.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + properties: properties, + ); + } + + @protected + HTTPCookie.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -2348,7 +2734,32 @@ class AuthenticationChallengeResponse extends PigeonInternalProxyApiBaseClass { /// /// Due to https://github.com/flutter/flutter/issues/162437, this should only /// be used for testing. - AuthenticationChallengeResponse({ + factory AuthenticationChallengeResponse({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + required UrlSessionAuthChallengeDisposition disposition, + URLCredential? credential, + }) { + if (PigeonOverrides.authenticationChallengeResponse_new != null) { + return PigeonOverrides.authenticationChallengeResponse_new!( + disposition: disposition, + credential: credential, + ); + } + return AuthenticationChallengeResponse.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + disposition: disposition, + credential: credential, + ); + } + + /// Creates an [AuthenticationChallengeResponse]. + /// + /// Due to https://github.com/flutter/flutter/issues/162437, this should only + /// be used for testing. + @protected + AuthenticationChallengeResponse.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, required this.disposition, @@ -2479,6 +2890,12 @@ class AuthenticationChallengeResponse extends PigeonInternalProxyApiBaseClass { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.authenticationChallengeResponse_createAsync != null) { + return PigeonOverrides.authenticationChallengeResponse_createAsync!( + disposition, + credential, + ); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -2545,12 +2962,16 @@ class WKWebsiteDataStore extends NSObject { _PigeonInternalProxyApiBaseCodec(pigeon_instanceManager); /// The default data store, which stores data persistently to disk. - static final WKWebsiteDataStore defaultDataStore = + static final WKWebsiteDataStore _defaultDataStore = pigeonVar_defaultDataStore(); /// The object that manages the HTTP cookies for your website. late final WKHTTPCookieStore httpCookieStore = pigeonVar_httpCookieStore(); + /// The default data store, which stores data persistently to disk. + static WKWebsiteDataStore get defaultDataStore => + PigeonOverrides.wKWebsiteDataStore_defaultDataStore ?? _defaultDataStore; + static void pigeon_setUpMessageHandlers({ bool pigeon_clearHandlers = false, BinaryMessenger? pigeon_binaryMessenger, @@ -3303,7 +3724,29 @@ class UIScrollView extends UIView { /// /// See https://developer.apple.com/documentation/webkit/wkwebviewconfiguration. class WKWebViewConfiguration extends NSObject { - WKWebViewConfiguration({ + factory WKWebViewConfiguration({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + }) { + if (PigeonOverrides.wKWebViewConfiguration_new != null) { + return PigeonOverrides.wKWebViewConfiguration_new!( + observeValue: observeValue); + } + return WKWebViewConfiguration.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + ); + } + + @protected + WKWebViewConfiguration.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -4087,7 +4530,37 @@ class WKPreferences extends NSObject { /// /// See https://developer.apple.com/documentation/webkit/wkscriptmessagehandler. class WKScriptMessageHandler extends NSObject { - WKScriptMessageHandler({ + factory WKScriptMessageHandler({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + required void Function( + WKScriptMessageHandler pigeon_instance, + WKUserContentController controller, + WKScriptMessage message, + ) didReceiveScriptMessage, + }) { + if (PigeonOverrides.wKScriptMessageHandler_new != null) { + return PigeonOverrides.wKScriptMessageHandler_new!( + observeValue: observeValue, + didReceiveScriptMessage: didReceiveScriptMessage, + ); + } + return WKScriptMessageHandler.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + didReceiveScriptMessage: didReceiveScriptMessage, + ); + } + + @protected + WKScriptMessageHandler.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -4237,7 +4710,87 @@ class WKScriptMessageHandler extends NSObject { /// /// See https://developer.apple.com/documentation/webkit/wknavigationdelegate. class WKNavigationDelegate extends NSObject { - WKNavigationDelegate({ + factory WKNavigationDelegate({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + String? url, + )? didFinishNavigation, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + String? url, + )? didStartProvisionalNavigation, + required Future Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + WKNavigationAction navigationAction, + ) decidePolicyForNavigationAction, + required Future Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + WKNavigationResponse navigationResponse, + ) decidePolicyForNavigationResponse, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + NSError error, + )? didFailNavigation, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + NSError error, + )? didFailProvisionalNavigation, + void Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + )? webViewWebContentProcessDidTerminate, + required Future Function( + WKNavigationDelegate pigeon_instance, + WKWebView webView, + URLAuthenticationChallenge challenge, + ) didReceiveAuthenticationChallenge, + }) { + if (PigeonOverrides.wKNavigationDelegate_new != null) { + return PigeonOverrides.wKNavigationDelegate_new!( + observeValue: observeValue, + didFinishNavigation: didFinishNavigation, + didStartProvisionalNavigation: didStartProvisionalNavigation, + decidePolicyForNavigationAction: decidePolicyForNavigationAction, + decidePolicyForNavigationResponse: decidePolicyForNavigationResponse, + didFailNavigation: didFailNavigation, + didFailProvisionalNavigation: didFailProvisionalNavigation, + webViewWebContentProcessDidTerminate: + webViewWebContentProcessDidTerminate, + didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, + ); + } + return WKNavigationDelegate.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + didFinishNavigation: didFinishNavigation, + didStartProvisionalNavigation: didStartProvisionalNavigation, + decidePolicyForNavigationAction: decidePolicyForNavigationAction, + decidePolicyForNavigationResponse: decidePolicyForNavigationResponse, + didFailNavigation: didFailNavigation, + didFailProvisionalNavigation: didFailProvisionalNavigation, + webViewWebContentProcessDidTerminate: + webViewWebContentProcessDidTerminate, + didReceiveAuthenticationChallenge: didReceiveAuthenticationChallenge, + ); + } + + @protected + WKNavigationDelegate.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -4892,7 +5445,28 @@ class WKNavigationDelegate extends NSObject { /// /// See https://developer.apple.com/documentation/objectivec/nsobject. class NSObject extends PigeonInternalProxyApiBaseClass { - NSObject({ + factory NSObject({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + }) { + if (PigeonOverrides.nSObject_new != null) { + return PigeonOverrides.nSObject_new!(observeValue: observeValue); + } + return NSObject.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + ); + } + + @protected + NSObject.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, this.observeValue, @@ -5146,7 +5720,33 @@ class NSObject extends PigeonInternalProxyApiBaseClass { /// /// See https://developer.apple.com/documentation/webkit/wkwebview. class UIViewWKWebView extends UIView implements WKWebView { - UIViewWKWebView({ + factory UIViewWKWebView({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + required WKWebViewConfiguration initialConfiguration, + }) { + if (PigeonOverrides.uIViewWKWebView_new != null) { + return PigeonOverrides.uIViewWKWebView_new!( + observeValue: observeValue, + initialConfiguration: initialConfiguration, + ); + } + return UIViewWKWebView.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + initialConfiguration: initialConfiguration, + ); + } + + @protected + UIViewWKWebView.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -5975,7 +6575,33 @@ class UIViewWKWebView extends UIView implements WKWebView { /// /// See https://developer.apple.com/documentation/webkit/wkwebview. class NSViewWKWebView extends NSObject implements WKWebView { - NSViewWKWebView({ + factory NSViewWKWebView({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + required WKWebViewConfiguration initialConfiguration, + }) { + if (PigeonOverrides.nSViewWKWebView_new != null) { + return PigeonOverrides.nSViewWKWebView_new!( + observeValue: observeValue, + initialConfiguration: initialConfiguration, + ); + } + return NSViewWKWebView.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + initialConfiguration: initialConfiguration, + ); + } + + @protected + NSViewWKWebView.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -6838,7 +7464,72 @@ class WKWebView extends NSObject { /// /// See https://developer.apple.com/documentation/webkit/wkuidelegate. class WKUIDelegate extends NSObject { - WKUIDelegate({ + factory WKUIDelegate({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + void Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + WKWebViewConfiguration configuration, + WKNavigationAction navigationAction, + )? onCreateWebView, + required Future Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + WKSecurityOrigin origin, + WKFrameInfo frame, + MediaCaptureType type, + ) requestMediaCapturePermission, + Future Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + String message, + WKFrameInfo frame, + )? runJavaScriptAlertPanel, + required Future Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + String message, + WKFrameInfo frame, + ) runJavaScriptConfirmPanel, + Future Function( + WKUIDelegate pigeon_instance, + WKWebView webView, + String prompt, + String? defaultText, + WKFrameInfo frame, + )? runJavaScriptTextInputPanel, + }) { + if (PigeonOverrides.wKUIDelegate_new != null) { + return PigeonOverrides.wKUIDelegate_new!( + observeValue: observeValue, + onCreateWebView: onCreateWebView, + requestMediaCapturePermission: requestMediaCapturePermission, + runJavaScriptAlertPanel: runJavaScriptAlertPanel, + runJavaScriptConfirmPanel: runJavaScriptConfirmPanel, + runJavaScriptTextInputPanel: runJavaScriptTextInputPanel, + ); + } + return WKUIDelegate.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + onCreateWebView: onCreateWebView, + requestMediaCapturePermission: requestMediaCapturePermission, + runJavaScriptAlertPanel: runJavaScriptAlertPanel, + runJavaScriptConfirmPanel: runJavaScriptConfirmPanel, + runJavaScriptTextInputPanel: runJavaScriptTextInputPanel, + ); + } + + @protected + WKUIDelegate.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -7421,7 +8112,38 @@ class WKHTTPCookieStore extends NSObject { /// /// See https://developer.apple.com/documentation/uikit/uiscrollviewdelegate. class UIScrollViewDelegate extends NSObject { - UIScrollViewDelegate({ + factory UIScrollViewDelegate({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + void Function( + UIScrollViewDelegate pigeon_instance, + UIScrollView scrollView, + double x, + double y, + )? scrollViewDidScroll, + }) { + if (PigeonOverrides.uIScrollViewDelegate_new != null) { + return PigeonOverrides.uIScrollViewDelegate_new!( + observeValue: observeValue, + scrollViewDidScroll: scrollViewDidScroll, + ); + } + return UIScrollViewDelegate.pigeon_new( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + scrollViewDidScroll: scrollViewDidScroll, + ); + } + + @protected + UIScrollViewDelegate.pigeon_new({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -7619,7 +8341,41 @@ class UIScrollViewDelegate extends NSObject { 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. - URLCredential.withUser({ + factory URLCredential.withUser({ + BinaryMessenger? pigeon_binaryMessenger, + PigeonInstanceManager? pigeon_instanceManager, + void Function( + NSObject pigeon_instance, + String? keyPath, + NSObject? object, + Map? change, + )? observeValue, + required String user, + required String password, + required UrlCredentialPersistence persistence, + }) { + if (PigeonOverrides.uRLCredential_withUser != null) { + return PigeonOverrides.uRLCredential_withUser!( + observeValue: observeValue, + user: user, + password: password, + persistence: persistence, + ); + } + return URLCredential.pigeon_withUser( + pigeon_binaryMessenger: pigeon_binaryMessenger, + pigeon_instanceManager: pigeon_instanceManager, + observeValue: observeValue, + user: user, + password: password, + persistence: persistence, + ); + } + + /// Creates a URL credential instance for internet password authentication + /// with a given user name and password, using a given persistence setting. + @protected + URLCredential.pigeon_withUser({ super.pigeon_binaryMessenger, super.pigeon_instanceManager, super.observeValue, @@ -7735,6 +8491,13 @@ class URLCredential extends NSObject { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.uRLCredential_withUserAsync != null) { + return PigeonOverrides.uRLCredential_withUserAsync!( + user, + password, + persistence, + ); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -7780,6 +8543,9 @@ class URLCredential extends NSObject { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.uRLCredential_serverTrustAsync != null) { + return PigeonOverrides.uRLCredential_serverTrustAsync!(trust); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -8479,6 +9245,9 @@ class SecTrust extends NSObject { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.secTrust_evaluateWithError != null) { + return PigeonOverrides.secTrust_evaluateWithError!(trust); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -8520,6 +9289,9 @@ class SecTrust extends NSObject { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.secTrust_copyExceptions != null) { + return PigeonOverrides.secTrust_copyExceptions!(trust); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -8557,6 +9329,12 @@ class SecTrust extends NSObject { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.secTrust_setExceptions != null) { + return PigeonOverrides.secTrust_setExceptions!( + trust, + exceptions, + ); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -8597,6 +9375,9 @@ class SecTrust extends NSObject { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.secTrust_getTrustResult != null) { + return PigeonOverrides.secTrust_getTrustResult!(trust); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -8637,6 +9418,9 @@ class SecTrust extends NSObject { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.secTrust_copyCertificateChain != null) { + return PigeonOverrides.secTrust_copyCertificateChain!(trust); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); @@ -8749,6 +9533,9 @@ class SecCertificate extends NSObject { BinaryMessenger? pigeon_binaryMessenger, PigeonInstanceManager? pigeon_instanceManager, }) async { + if (PigeonOverrides.secCertificate_copyData != null) { + return PigeonOverrides.secCertificate_copyData!(certificate); + } final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = _PigeonInternalProxyApiBaseCodec( pigeon_instanceManager ?? PigeonInstanceManager.instance); diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml index 7ba904f1a30..697289b769a 100644 --- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml @@ -33,7 +33,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^25.3.2 + pigeon: ^26.0.0 topics: - html